From 023143f7cd2ed107e9d2c61ef3695cfc44f19a8c Mon Sep 17 00:00:00 2001 From: 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: http://svn.automattic.com/wordpress/trunk@19024 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 72d25e3d2..8626093c3 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; }