Make WordPress Core

Changeset 59562


Ignore:
Timestamp:
12/26/2024 11:55:05 PM (23 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in get_active_blog_for_user().

Follow-up to ​mu:804, ​mu:1918.

Props debarghyabanerjee, aristath, poena, afercia, SergeyBiryukov.
See #62279, #62283.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r59561 r59562  
    7272        }
    7373
    74         if ( ( ! is_object( $primary ) ) || ( 1 == $primary->archived || 1 == $primary->spam || 1 == $primary->deleted ) ) {
     74        if ( ( ! is_object( $primary ) )
     75                || ( '1' === $primary->archived || '1' === $primary->spam || '1' === $primary->deleted )
     76        ) {
    7577                $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs.
    7678                $ret   = false;
    7779                if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
    7880                        foreach ( (array) $blogs as $blog_id => $blog ) {
    79                                 if ( get_current_network_id() != $blog->site_id ) {
     81                                if ( get_current_network_id() !== $blog->site_id ) {
    8082                                        continue;
    8183                                }
     84
    8285                                $details = get_site( $blog_id );
    83                                 if ( is_object( $details ) && 0 == $details->archived && 0 == $details->spam && 0 == $details->deleted ) {
     86                                if ( is_object( $details )
     87                                        && '0' === $details->archived && '0' === $details->spam && '0' === $details->deleted
     88                                ) {
    8489                                        $ret = $details;
    85                                         if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) {
     90                                        if ( (int) get_user_meta( $user_id, 'primary_blog', true ) !== $blog_id ) {
    8691                                                update_user_meta( $user_id, 'primary_blog', $blog_id );
    8792                                        }
Note: See TracChangeset for help on using the changeset viewer.