WordPress.org

Make WordPress Core

Ticket #18164: 18164.2.diff

File 18164.2.diff, 792 bytes (added by fonglh, 3 years ago)
  • wp-admin/users.php

     
    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 promote_users caps unless he is a network admin 
     71                if ( $id == $current_user->ID && ( !is_super_admin( $current_user->ID ) && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) ) { 
    7272                        $update = 'err_admin_role'; 
    7373                        continue; 
    7474                }