From 156a5a234f534ff83cdbda3198b86f8521ae7f5d Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 25 Mar 2014 12:14:14 +0000 Subject: [PATCH] Multisite: Don't set the $super_admins global in grant_super_admin(), revoke_super_admin(). Adds tests and docs. props jdgrimes. see #27205. Built from https://develop.svn.wordpress.org/trunk@27706 git-svn-id: http://core.svn.wordpress.org/trunk@27545 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ms.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index f048417186..59c28b382b 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -686,13 +686,14 @@ function choose_primary_blog() { * * @since 3.0.0 * @param int $user_id ID of the user to be granted Super Admin privileges. + * @return bool True on success, false on failure. This can fail when the user is + * already a super admin or when the $super_admins global is defined. */ function grant_super_admin( $user_id ) { - global $super_admins; - // If global super_admins override is defined, there is nothing to do here. - if ( isset( $super_admins ) ) + if ( isset( $GLOBALS['super_admins'] ) ) { return false; + } /** * Fires before the user is granted Super Admin privileges. @@ -729,13 +730,14 @@ function grant_super_admin( $user_id ) { * * @since 3.0.0 * @param int $user_id ID of the user Super Admin privileges to be revoked from. + * @return bool True on success, false on failure. This can fail when the user's email + * is the network admin email or when the $super_admins global is defined. */ function revoke_super_admin( $user_id ) { - global $super_admins; - // If global super_admins override is defined, there is nothing to do here. - if ( isset( $super_admins ) ) + if ( isset( $GLOBALS['super_admins'] ) ) { return false; + } /** * Fires before the user's Super Admin privileges are revoked.