Statistics: Posted by Jason Caldwell — May 23rd, 2011, 10:33 pm
Statistics: Posted by Cristián Lávaque — May 23rd, 2011, 9:40 pm
/**
* Determine if user is a site admin.
*
* @since 3.0.0
*
* @param int $user_id (Optional) The ID of a user. Defaults to the current user.
* @return bool True if the user is a site admin.
*/
function is_super_admin( $user_id = false ) {
if ( $user_id )
$user = new WP_User( $user_id );
else
$user = wp_get_current_user();
if ( empty( $user->id ) )
return false;
if ( is_multisite() ) {
$super_admins = get_super_admins();
if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins ) )
return true;
} else {
if ( $user->has_cap('delete_users') )
return true;
}
return false;
}
Statistics: Posted by Jason Caldwell — May 23rd, 2011, 9:17 pm
Statistics: Posted by Jason Caldwell — May 23rd, 2011, 5:25 pm
Statistics: Posted by Jason Caldwell — May 23rd, 2011, 4:38 am
Statistics: Posted by cassel — May 21st, 2011, 11:16 pm
Statistics: Posted by cassel — May 21st, 2011, 10:31 pm
Statistics: Posted by Cristián Lávaque — May 21st, 2011, 10:21 pm
Statistics: Posted by cassel — May 21st, 2011, 6:46 pm