WordPress.org

Make WordPress Core

Ticket #11644: 11644.2.diff

File 11644.2.diff, 2.1 KB (added by nacin, 10 years ago)

Deprecate is_site_admin().

  • wp-includes/ms-deprecated.php

     
    2323        return wp_generate_password($len);
    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?>
     60 No newline at end of file
  • wp-includes/ms-functions.php

     
    184184}
    185185
    186186/**
    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);
    208 }
    209 
    210 /**
    211187 * Retrieve option value based on setting name and blog_id.
    212188 *
    213189 * If the option does not exist or does not have a value, then the return value