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.

git-svn-id: https://develop.svn.wordpress.org/trunk@55672 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-04-21 09:48:41 +00:00
parent 2c6bf77a9e
commit fa92c3fcf2
2 changed files with 5 additions and 5 deletions

View File

@ -102,7 +102,7 @@ if ( isset( $_GET['action'] ) ) {
header( 'Content-Type: text/html; charset=utf-8' );
}
if ( get_network()->site_id == $id ) {
if ( is_main_site( $id ) ) {
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
}
@ -142,7 +142,7 @@ if ( isset( $_GET['action'] ) ) {
}
$updated_action = 'not_deleted';
if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) {
if ( '0' != $id && ! is_main_site( $id ) && current_user_can( 'delete_site', $id ) ) {
wpmu_delete_blog( $id, true );
$updated_action = 'delete';
}
@ -154,7 +154,7 @@ if ( isset( $_GET['action'] ) ) {
foreach ( (array) $_POST['site_ids'] as $site_id ) {
$site_id = (int) $site_id;
if ( get_network()->site_id == $site_id ) {
if ( is_main_site( $site_id ) ) {
continue;
}
@ -182,7 +182,7 @@ if ( isset( $_GET['action'] ) ) {
$doaction = $_POST['action'];
foreach ( (array) $_POST['allblogs'] as $key => $val ) {
if ( '0' != $val && get_network()->site_id != $val ) {
if ( '0' != $val && ! is_main_site( $val ) ) {
switch ( $doaction ) {
case 'delete':
require_once ABSPATH . 'wp-admin/admin-header.php';

View File

@ -94,7 +94,7 @@ if ( isset( $_GET['action'] ) ) {
$blogs = get_blogs_of_user( $user_id, true );
foreach ( (array) $blogs as $details ) {
if ( get_network()->site_id != $details->userblog_id ) { // Main blog is not a spam!
if ( ! is_main_site( $details->userblog_id ) ) { // Main site is not a spam!
update_blog_status( $details->userblog_id, 'spam', '1' );
}
}