Allow a super admin to demote themselves on a site to a role that does not contain the promote_users cap. props fonglh, fixes #18164.

git-svn-id: https://develop.svn.wordpress.org/trunk@19024 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-10-20 14:12:25 +00:00
parent 3b167b98ae
commit fe4f927a80

View File

@ -67,8 +67,8 @@ 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 promote_users caps
if ( $id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) {
// 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;
}