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/ms-functions.php

    r21387 r21413  
    184184    switch_to_blog($blog_id);
    185185
    186     $user = new WP_User($user_id);
    187 
    188     if ( ! $user->exists() ) {
     186    $user = get_userdata( $user_id );
     187
     188    if ( ! $user ) {
    189189        restore_current_blog();
    190190        return new WP_Error('user_does_not_exist', __('That user does not exist.'));
     
    247247
    248248    // wp_revoke_user($user_id);
    249     $user = new WP_User($user_id);
    250     if ( ! $user->exists() ) {
     249    $user = get_userdata( $user_id );
     250    if ( ! $user ) {
    251251        restore_current_blog();
    252252        return new WP_Error('user_does_not_exist', __('That user does not exist.'));
     
    10571057        return false;
    10581058
    1059     $user = new WP_User($user_id);
     1059    $user = get_userdata( $user_id );
    10601060
    10611061    $options_site_url = esc_url(network_admin_url('settings.php'));
     
    12341234
    12351235    $url = get_blogaddress_by_id($blog_id);
    1236     $user = new WP_User($user_id);
     1236    $user = get_userdata( $user_id );
    12371237
    12381238    $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
     
    12831283    $welcome_email = get_site_option( 'welcome_user_email' );
    12841284
    1285     $user = new WP_User($user_id);
     1285    $user = get_userdata( $user_id );
    12861286
    12871287    $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta);
     
    15091509function wpmu_log_new_registrations( $blog_id, $user_id ) {
    15101510    global $wpdb;
    1511     $user = new WP_User( (int) $user_id );
     1511    $user = get_userdata( (int) $user_id );
    15121512    $wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
    15131513}
     
    17521752        $user_id = get_user_id_from_string( $username );
    17531753    }
    1754     $u = new WP_User( $user_id );
     1754    $u = get_userdata( $user_id );
    17551755
    17561756    return ( isset( $u->spam ) && $u->spam == 1 );
Note: See TracChangeset for help on using the changeset viewer.