Skip to content

Commit

Permalink
Networks and Sites: Use is_main_site() in a few more places.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SergeyBiryukov committed Apr 21, 2023
1 parent 469d8a5 commit 47ef384
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions wp-admin/network/sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
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.' ) );
}

Expand Down Expand Up @@ -142,7 +142,7 @@
}

$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';
}
Expand All @@ -154,7 +154,7 @@
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;
}

Expand Down Expand Up @@ -182,7 +182,7 @@
$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';
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
$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' );
}
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @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.
Expand Down

0 comments on commit 47ef384

Please sign in to comment.