Make WordPress Core


Ignore:
Timestamp:
10/19/2025 05:40:13 PM (3 months ago)
Author:
johnjamesjacoby
Message:

Networks and Sites: remove email address check when attempting to demote a Super Admin.

This change ensures that a capable Super Admin is allowed to manage global Users as intended, and removes an invisible & undocumented restriction (that was easily bypassed anyways).

It also adds 1 multisite unit test to confirm the intended behavior

Props flixos90, johnjamesjacoby, Mista-Flo.

Fixes #39170.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-edit.php

    r60679 r60977  
    472472                    <?php endif; // End if ! IS_PROFILE_PAGE. ?>
    473473
    474                     <?php if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && ! isset( $super_admins ) ) : ?>
     474                    <?php if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && ! isset( $super_admins ) ) : ?>
    475475                        <tr class="user-super-admin-wrap">
    476476                            <th><?php _e( 'Super Admin' ); ?></th>
    477477                            <td>
    478                                 <?php if ( 0 !== strcasecmp( $profile_user->user_email, get_site_option( 'admin_email' ) ) || ! is_super_admin( $profile_user->ID ) ) : ?>
    479                                     <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profile_user->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>
    480                                 <?php else : ?>
    481                                     <p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
    482                                 <?php endif; ?>
     478                                <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profile_user->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>
    483479                            </td>
    484480                        </tr>
Note: See TracChangeset for help on using the changeset viewer.