Only allow _multisite_ super admins to demote themselves on a site. props linuxologos, see #19684 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@19640 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-12-30 23:13:48 +00:00
parent 3350723c21
commit 2758e7fb6a
1 changed files with 5 additions and 4 deletions

View File

@ -100,10 +100,11 @@ case 'promote':
if ( ! current_user_can('promote_user', $id) )
wp_die(__('You can’t edit that user.'));
// The new role of the current user must also have the promote_users cap or be a super admin
if ( $id == $current_user->ID && ! is_super_admin() && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users') ) {
$update = 'err_admin_role';
continue;
// The new role of the current user must also have the promote_users cap or be a multisite super admin
if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users')
&& ! ( is_multisite() && is_super_admin() ) ) {
$update = 'err_admin_role';
continue;
}
// If the user doesn't already belong to the blog, bail.