WordPress.org

Make WordPress Core

Changeset 15404


Ignore:
Timestamp:
07/13/2010 09:27:05 PM (8 years ago)
Author:
nacin
Message:

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

Location:
trunk
Files:
3 edited

Legend:

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

    r15351 r15404  
    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 );
  • trunk/wp-includes/capabilities.php

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

    r15315 r15404  
    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.