From fe4f927a80e150252e7a083bfc8c311fdc05cf4a Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 20 Oct 2011 14:12:25 +0000 Subject: [PATCH] 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 --- wp-admin/users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/users.php b/wp-admin/users.php index 72d25e3d2a..8626093c39 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -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; }