WordPress.org

Make WordPress Core

Ticket #21120: 21120.2.diff

File 21120.2.diff, 976 bytes (added by nacin, 3 years ago)

This ought to be API'd as suggested in the comment, but this does a number to the profiling output..

  • wp-includes/capabilities.php

     
    13801380 * @return bool True if the user is a site admin. 
    13811381 */ 
    13821382function is_super_admin( $user_id = false ) { 
    1383         if ( $user_id ) 
     1383        if ( $user_id && $user_id != get_current_user_id() ) 
    13841384                $user = new WP_User( $user_id ); 
    13851385        else 
    13861386                $user = wp_get_current_user(); 
  • wp-includes/pluggable.php

     
    133133 * @return bool|object False on failure, WP_User object on success 
    134134 */ 
    135135function get_user_by( $field, $value ) { 
     136        if ( 'id' === $field && get_current_user_id() == $value ) 
     137                return wp_get_current_user(); 
     138 
    136139        $userdata = WP_User::get_data_by( $field, $value ); 
    137140 
    138141        if ( !$userdata )