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.
Built from https://develop.svn.wordpress.org/trunk@55672


git-svn-id: http://core.svn.wordpress.org/trunk@55184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-04-21 09:50:19 +00:00
parent 469d8a5e24
commit 47ef384731
3 changed files with 6 additions and 6 deletions

View File

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

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-alpha-55671'; $wp_version = '6.3-alpha-55672';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.