Only allow _multisite_ super admins to demote themselves on a site. props linuxologos, see #19684 for trunk.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-12-30 23:13:48 +00:00
parent 7931ec33f1
commit 9aa60c4066
1 changed files with 5 additions and 4 deletions

View File

@ -100,8 +100,9 @@ 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 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') ) {
// The new role of the current user must also have the promote_users cap or be a multisite super admin
if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users')
&& ! ( is_multisite() && is_super_admin() ) ) {
$update = 'err_admin_role';
continue;
}