Multisite: Return `WP_Site` as expected in `get_active_blog_for_user()`.

Previously it was possible for a standard object representing the site to be returned in some cases.

Fixes #38430.


git-svn-id: https://develop.svn.wordpress.org/trunk@42866 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2018-03-20 23:06:57 +00:00
parent f9b33fb524
commit 96695f2864
1 changed files with 2 additions and 2 deletions

View File

@ -76,12 +76,12 @@ function get_active_blog_for_user( $user_id ) {
} }
$details = get_site( $blog_id ); $details = get_site( $blog_id );
if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) { if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
$ret = $blog; $ret = $details;
if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) { if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) {
update_user_meta( $user_id, 'primary_blog', $blog_id ); update_user_meta( $user_id, 'primary_blog', $blog_id );
} }
if ( ! get_user_meta( $user_id, 'source_domain', true ) ) { if ( ! get_user_meta( $user_id, 'source_domain', true ) ) {
update_user_meta( $user_id, 'source_domain', $blog->domain ); update_user_meta( $user_id, 'source_domain', $details->domain );
} }
break; break;
} }