WordPress.org

Make WordPress Core

Ticket #11271: 11271-setup_userdata.patch

File 11271-setup_userdata.patch, 1.3 KB (added by nacin, 6 years ago)
  • wp-includes/user.php

     
    451451 * @param int $user_id Optional. User ID to setup global data. 
    452452 */ 
    453453function setup_userdata($user_id = '') { 
    454         global $user_login, $userdata, $user_level, $user_id, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; 
    455  
     454        global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; 
     455         
    456456        if ( '' == $user_id ) 
    457457                $user = wp_get_current_user(); 
    458458        else 
     
    461461        if ( 0 == $user->ID ) 
    462462                return; 
    463463 
    464         $userdata = $user->data; 
    465         $user_login     = $user->user_login; 
    466         $user_level     = (int) isset($user->user_level) ? $user->user_level : 0; 
    467         $user_id = $user_ID = (int) $user->ID; 
    468         $user_email     = $user->user_email; 
    469         $user_url       = $user->user_url; 
    470         $user_pass_md5  = md5($user->user_pass); 
    471         $user_identity  = $user->display_name; 
     464        $userdata   = $user->data; 
     465        $user_login = $user->user_login; 
     466        $user_level = (int) isset( $user->user_level ) ? $user->user_level : 0; 
     467        $user_ID    = (int) $user->ID; 
     468        $user_email = $user->user_email; 
     469        $user_url   = $user->user_url; 
     470        $user_pass_md5 = md5( $user->user_pass ); 
     471        $user_identity = $user->display_name; 
    472472} 
    473473 
    474474/**