WordPress.org

Make WordPress Core

Changeset 15403


Ignore:
Timestamp:
07/13/10 21:26:43 (5 years ago)
Author:
nacin
Message:

Fix checking for whether WP_User object is actually a user. props filosofo, fixes #13903 for 3.0.

Location:
branches/3.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-admin/ms-edit.php

    r15352 r15403  
    266266            foreach ( (array) $newroles as $userid => $role ) { 
    267267                $user = new WP_User( $userid ); 
    268                 if ( ! $user ) 
     268                if ( empty( $user->ID ) ) 
    269269                    continue; 
    270270                $user->for_blog( $id ); 
  • branches/3.0/wp-includes/capabilities.php

    r15312 r15403  
    11131113    $author = new WP_User( $post->post_author ); 
    11141114 
    1115     if ( empty( $author ) ) 
     1115    if ( empty( $author->ID ) ) 
    11161116        return false; 
    11171117 
  • branches/3.0/wp-includes/ms-functions.php

    r15289 r15403  
    210210    $user = new WP_User($user_id); 
    211211 
    212     if ( empty($user) || !$user->ID ) 
     212    if ( empty( $user->ID ) ) 
    213213        return new WP_Error('user_does_not_exist', __('That user does not exist.')); 
    214214 
     
    254254    // wp_revoke_user($user_id); 
    255255    $user = new WP_User($user_id); 
     256    if ( empty( $user->ID ) ) 
     257        return new WP_Error('user_does_not_exist', __('That user does not exist.')); 
     258 
    256259    $user->remove_all_caps(); 
    257260 
     
    13271330    $u = new WP_User( $user_id ); 
    13281331 
    1329     if ( $u->spam == 1 ) 
    1330         return true; 
    1331  
    1332     return false; 
     1332    return ( isset( $u->spam ) && $u->spam == 1 ); 
    13331333} 
    13341334 
Note: See TracChangeset for help on using the changeset viewer.