Make WordPress Core

Changeset 55672


Ignore:
Timestamp:
04/21/2023 09:48:41 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Networks and Sites: Use is_main_site() in a few more places.

This updates some more instances of comparing site IDs on Sites and Users screens in network admin to use is_main_site() for clarity.

Follow-up to [12603], [13918], [22064], [38814], [41131], [55666].

See #58150.

Location:
trunk/src/wp-admin/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/sites.php

    r55418 r55672  
    103103                }
    104104
    105                 if ( get_network()->site_id == $id ) {
     105                if ( is_main_site( $id ) ) {
    106106                        wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
    107107                }
     
    143143
    144144                        $updated_action = 'not_deleted';
    145                         if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) {
     145                        if ( '0' != $id && ! is_main_site( $id ) && current_user_can( 'delete_site', $id ) ) {
    146146                                wpmu_delete_blog( $id, true );
    147147                                $updated_action = 'delete';
     
    155155                                $site_id = (int) $site_id;
    156156
    157                                 if ( get_network()->site_id == $site_id ) {
     157                                if ( is_main_site( $site_id ) ) {
    158158                                        continue;
    159159                                }
     
    183183
    184184                                foreach ( (array) $_POST['allblogs'] as $key => $val ) {
    185                                         if ( '0' != $val && get_network()->site_id != $val ) {
     185                                        if ( '0' != $val && ! is_main_site( $val ) ) {
    186186                                                switch ( $doaction ) {
    187187                                                        case 'delete':
  • trunk/src/wp-admin/network/users.php

    r55418 r55672  
    9595
    9696                                                                foreach ( (array) $blogs as $details ) {
    97                                                                         if ( get_network()->site_id != $details->userblog_id ) { // Main blog is not a spam!
     97                                                                        if ( ! is_main_site( $details->userblog_id ) ) { // Main site is not a spam!
    9898                                                                                update_blog_status( $details->userblog_id, 'spam', '1' );
    9999                                                                        }
Note: See TracChangeset for help on using the changeset viewer.