Changeset 12611
- Timestamp:
- 01/06/2010 11:27:22 PM (15 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/capabilities.php
r12597 r12611 1063 1063 } 1064 1064 1065 /** 1066 * Determine if user is a site admin. 1067 * 1068 * @since 3.0 1069 * 1070 * @param int $user_id (Optional) The ID of a user. Defaults to the current user. 1071 * @return bool True if the user is a site admin. 1072 */ 1073 function is_super_admin( $user_id = false ) { 1074 global $current_user; 1075 1076 if ( !$current_user && !$user_id ) 1077 return false; 1078 1079 if ( !$user_id ) 1080 $user_id = $current_user->id; 1081 1082 if ( !$user_id ) 1083 return false; 1084 1085 $user = new WP_User($user_id); 1086 1087 $site_admins = get_site_option( 'site_admins', array('admin') ); 1088 if ( is_array( $site_admins ) && in_array( $user->user_login, $site_admins ) ) 1089 return true; 1090 1091 return false; 1092 } 1093 1065 1094 ?> -
trunk/wp-includes/ms-functions.php
r12610 r12611 184 184 } 185 185 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 */ 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; 196 200 } 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); 205 208 } 206 209
Note: See TracChangeset
for help on using the changeset viewer.