Skip to content

Commit

Permalink
Coding Standards: Use strict comparison in get_active_blog_for_user().
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SergeyBiryukov committed Dec 26, 2024
1 parent 27bb7ac commit 20110f6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/wp-includes/ms-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down

0 comments on commit 20110f6

Please sign in to comment.