From 20110f63aac507e2b64bb2b6270471957dec8ca3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 26 Dec 2024 23:55:05 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@59562 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/ms-functions.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index 9f1889fda6b36..fdbcc6fb78e83 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/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 ) ) {