From dbbdd23e30b6279b526e82212404db331c5d726c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 26 Dec 2024 23:57:24 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `get_active_blog_for_user()`. Follow-up to [https://mu.trac.wordpress.org/changeset/804 mu:804], [https://mu.trac.wordpress.org/changeset/1918 mu:1918]. Props debarghyabanerjee, aristath, poena, afercia, SergeyBiryukov. See #62279, #62283. Built from https://develop.svn.wordpress.org/trunk@59562 git-svn-id: http://core.svn.wordpress.org/trunk@58948 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-functions.php | 13 +++++++++---- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 9f1889fda6..fdbcc6fb78 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -71,18 +71,23 @@ function get_active_blog_for_user( $user_id ) { } } - if ( ( ! is_object( $primary ) ) || ( 1 == $primary->archived || 1 == $primary->spam || 1 == $primary->deleted ) ) { + if ( ( ! is_object( $primary ) ) + || ( '1' === $primary->archived || '1' === $primary->spam || '1' === $primary->deleted ) + ) { $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs. $ret = false; if ( is_array( $blogs ) && count( $blogs ) > 0 ) { foreach ( (array) $blogs as $blog_id => $blog ) { - if ( get_current_network_id() != $blog->site_id ) { + if ( get_current_network_id() !== $blog->site_id ) { continue; } + $details = get_site( $blog_id ); - if ( is_object( $details ) && 0 == $details->archived && 0 == $details->spam && 0 == $details->deleted ) { + if ( is_object( $details ) + && '0' === $details->archived && '0' === $details->spam && '0' === $details->deleted + ) { $ret = $details; - if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) { + if ( (int) get_user_meta( $user_id, 'primary_blog', true ) !== $blog_id ) { update_user_meta( $user_id, 'primary_blog', $blog_id ); } if ( ! get_user_meta( $user_id, 'source_domain', true ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 709a4dbafb..777de14db4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59561'; +$wp_version = '6.8-alpha-59562'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.