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.
Built from https://develop.svn.wordpress.org/trunk@59562


git-svn-id: http://core.svn.wordpress.org/trunk@58948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-12-26 23:57:24 +00:00
parent 767dea88eb
commit dbbdd23e30
2 changed files with 10 additions and 5 deletions

View File

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

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8-alpha-59561';
$wp_version = '6.8-alpha-59562';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.