Make WordPress Core


Ignore:
Timestamp:
01/06/2010 11:27:22 PM (15 years ago)
Author:
ryan
Message:

Introduce is_super_admin(). see #11644.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-functions.php

    r12610 r12611  
    184184}
    185185
    186 function is_site_admin( $user_login = false ) {
    187     global $current_user;
    188 
    189     if ( !$current_user && !$user_login )
    190         return false;
    191 
    192     if ( $user_login ) {
    193         $user_login = sanitize_user( $user_login );
    194     } elseif( isset( $current_user->user_login ) ) {
    195         $user_login = $current_user->user_login;
     186/**
     187 * Determine if user is a site admin.
     188 *
     189 * @deprecated Use {@link is_keymaster()}
     190 *
     191 */
     192function is_site_admin( $user_login = '' ) {
     193    // This function must reside in a file included only if is_multsite() since many plugins
     194    // test for its existence to determine if multisite is enabled.
     195
     196    if ( empty($user_login) ) {
     197        $user_id = get_current_user_id();
     198        if ( !$user_id )
     199            return false;
    196200    } else {
    197         return false;
    198     }
    199 
    200     $site_admins = get_site_option( 'site_admins', array('admin') );
    201     if( is_array( $site_admins ) && in_array( $user_login, $site_admins ) )
    202         return true;
    203 
    204     return false;
     201        $user = new WP_User(null, $user_login);
     202        if ( empty($user->id) )
     203            return false;
     204        $user_id = $user->id;
     205    }
     206
     207    return is_super_admin($user_id);
    205208}
    206209
Note: See TracChangeset for help on using the changeset viewer.