WordPress.org

Make WordPress Core

Changeset 12645


Ignore:
Timestamp:
01/07/10 15:50:46 (5 years ago)
Author:
ryan
Message:

Deprecate is_site_admin. Props nacin. see #11644

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r12635 r12645  
    2424} 
    2525 
     26/** 
     27 * Determine if user is a site admin. 
     28 * 
     29 * Plugins should use is_multisite() instead of checking if this function exists 
     30 * to determine if multisite is enabled. 
     31 * 
     32 * This function must reside in a file included only if is_multisite() due to 
     33 * legacy function_exists() checks to determine if multisite is enabled. 
     34 * 
     35 * @since unknown 
     36 * @deprecated 3.0 
     37 * @deprecated Use is_super_admin() 
     38 * @see is_super_admin() 
     39 * @see is_multisite() 
     40 * 
     41 */ 
     42function is_site_admin( $user_login = '' ) { 
     43    _deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' ); 
     44 
     45    if ( empty( $user_login ) ) { 
     46        $user_id = get_current_user_id(); 
     47        if ( !$user_id ) 
     48            return false; 
     49    } else { 
     50        $user = new WP_User( null, $user_login) ; 
     51        if ( empty( $user->id ) ) 
     52            return false; 
     53        $user_id = $user->id; 
     54    } 
     55 
     56    return is_super_admin( $user_id ); 
     57} 
     58 
    2659?> 
  • trunk/wp-includes/ms-functions.php

    r12643 r12645  
    182182    global $current_user; 
    183183    return $current_user->ID; 
    184 } 
    185  
    186 /** 
    187  * Determine if user is a site admin. 
    188  * 
    189  * @deprecated Use {@link is_keymaster()} 
    190  * 
    191  */ 
    192 function 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; 
    200     } else { 
    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); 
    208184} 
    209185 
Note: See TracChangeset for help on using the changeset viewer.