Skip to content

Commit 20110f6

Browse files
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
1 parent 27bb7ac commit 20110f6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/wp-includes/ms-functions.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,23 @@ function get_active_blog_for_user( $user_id ) {
7171
}
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
}
8893
if ( ! get_user_meta( $user_id, 'source_domain', true ) ) {

0 commit comments

Comments
 (0)