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 ) ) {