Make WordPress Core


Ignore:
Timestamp:
08/03/2012 01:06:05 AM (12 years ago)
Author:
nacin
Message:

Move most instances of new WP_User to get_userdata(). see #21120.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r21377 r21413  
    12381238
    12391239    // Create new object to avoid stomping the global current_user.
    1240     $user = new WP_User( $current_user->ID) ;
     1240    $user = new WP_User( $current_user->ID );
    12411241
    12421242    // Set the blog id. @todo add blog id arg to WP_User constructor?
     
    12621262        return false;
    12631263
    1264     $author = new WP_User( $post->post_author );
    1265 
    1266     if ( empty( $author->ID ) )
     1264    $author = get_userdata( $post->post_author );
     1265
     1266    if ( ! $author )
    12671267        return false;
    12681268
     
    12841284function user_can( $user, $capability ) {
    12851285    if ( ! is_object( $user ) )
    1286         $user = new WP_User( $user );
     1286        $user = get_userdata( $user );
    12871287
    12881288    if ( ! $user || ! $user->exists() )
Note: See TracChangeset for help on using the changeset viewer.