Skip to content

Commit 27d96cb

Browse files
author
nacin
committed
Only allow _multisite_ super admins to demote themselves on a site. props linuxologos, see #19684 for trunk.
git-svn-id: http://core.svn.wordpress.org/trunk@19640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent ff8fbe1 commit 27d96cb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

wp-admin/users.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@
100100

101101
if ( ! current_user_can('promote_user', $id) )
102102
wp_die(__('You can’t edit that user.'));
103-
// The new role of the current user must also have the promote_users cap or be a super admin
104-
if ( $id == $current_user->ID && ! is_super_admin() && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users') ) {
105-
$update = 'err_admin_role';
106-
continue;
103+
// The new role of the current user must also have the promote_users cap or be a multisite super admin
104+
if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users')
105+
&& ! ( is_multisite() && is_super_admin() ) ) {
106+
$update = 'err_admin_role';
107+
continue;
107108
}
108109

109110
// If the user doesn't already belong to the blog, bail.

0 commit comments

Comments
 (0)