Assume current user of user ID is not passed. Props filosofo. fixes #11808

git-svn-id: https://develop.svn.wordpress.org/trunk@12650 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-01-07 19:45:57 +00:00
parent 866c3021d4
commit d93a81bd35
4 changed files with 81 additions and 28 deletions

View File

@@ -1085,15 +1085,12 @@ function remove_role( $role ) {
* @return bool True if the user is a site admin.
*/
function is_super_admin( $user_id = false ) {
global $current_user;
if ( ! $user_id ) {
$current_user = wp_get_current_user();
$user_id = ! empty($current_user) ? $current_user->id : 0;
}
if ( !$current_user && !$user_id )
return false;
if ( !$user_id )
$user_id = $current_user->id;
if ( !$user_id )
if ( ! $user_id )
return false;
$user = new WP_User($user_id);