Skip to content

Commit fe4f927

Browse files
committed
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
1 parent 3b167b9 commit fe4f927

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wp-admin/users.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767

6868
if ( ! current_user_can('promote_user', $id) )
6969
wp_die(__('You can’t edit that user.'));
70-
// The new role of the current user must also have promote_users caps
71-
if ( $id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) {
70+
// The new role of the current user must also have the promote_users cap or be a super admin
71+
if ( $id == $current_user->ID && ! is_super_admin() && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users') ) {
7272
$update = 'err_admin_role';
7373
continue;
7474
}

0 commit comments

Comments
 (0)