WordPress.org

Make WordPress Core

Changeset 15608


Ignore:
Timestamp:
09/10/2010 11:24:34 PM (9 years ago)
Author:
nacin
Message:

More efficient is_super_admin(). Don't call new WP_User on the current user. props mdawaffe, fixes #14842.

File:
1 edited

Legend:

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

    r15596 r15608  
    12141214 */
    12151215function is_super_admin( $user_id = false ) {
    1216     if ( ! $user_id ) {
    1217         $current_user = wp_get_current_user();
    1218         $user_id = ! empty($current_user) ? $current_user->id : 0;
    1219     }
    1220 
    1221     if ( ! $user_id )
     1216    if ( $user_id )
     1217        $user = new WP_User( $user_id );
     1218    else
     1219        $user = wp_get_current_user();
     1220
     1221    if ( empty( $user->id ) )
    12221222        return false;
    1223 
    1224     $user = new WP_User($user_id);
    12251223
    12261224    if ( is_multisite() ) {
Note: See TracChangeset for help on using the changeset viewer.