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: http://svn.automattic.com/wordpress/trunk@19024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-10-20 14:12:25 +00:00
parent 759475df38
commit 023143f7cd
1 changed files with 2 additions and 2 deletions

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;
}