Make WordPress Core

Ticket #2134: 2134.diff

File 2134.diff, 1.4 KB (added by westi, 17 years ago)

Patched refreshed to apply to current trunk

  • wp-includes/pluggable.php

     
    123123
    124124        $user_login = $wpdb->escape($user_login);
    125125
    126         if ( !$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'") )
     126        if ( !$temp_user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'") )
    127127                return false;
    128128
    129         $wpdb->hide_errors();
    130         $metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user->ID'");
    131         $wpdb->show_errors();
    132 
    133         if ($metavalues) {
    134                 foreach ( $metavalues as $meta ) {
    135                         $value = maybe_unserialize($meta->meta_value);
    136                         $user->{$meta->meta_key} = $value;
    137 
    138                         // We need to set user_level from meta, not row
    139                         if ( $wpdb->prefix . 'user_level' == $meta->meta_key )
    140                                 $user->user_level = $meta->meta_value;
    141                 }
    142         }
    143 
    144         // For backwards compat.
    145         if ( isset($user->first_name) )
    146                 $user->user_firstname = $user->first_name;
    147         if ( isset($user->last_name) )
    148                 $user->user_lastname = $user->last_name;
    149         if ( isset($user->description) )
    150                 $user->user_description = $user->description;
    151 
    152         wp_cache_add($user->ID, $user, 'users');
    153         wp_cache_add($user->user_login, $user->ID, 'userlogins');
     129        $user = get_userdata($temp_user->ID);
    154130        return $user;
    155 
    156131}
    157132endif;
    158133