Make WordPress Core

Changeset 19024


Ignore:
Timestamp:
10/20/2011 02:12:25 PM (13 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/users.php

    r18911 r19024  
    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;
Note: See TracChangeset for help on using the changeset viewer.