get_active_blog_for_user() expects a more decorated blog object
|Reported by:||nacin||Owned by:|
If the user has no primary_blog set yet, we chop off the first blog returned in get_blogs_of_user(), set that ID as the primary_blog, and let the function continue.
The issue is a line of code that expects if $primary is an object, then it has the archived, spam, and deleted properties set.
This is only the case if the blog object came from get_blog_details() (as in, the primary_blog has already been set). For whatever reason, get_blogs_of_user() does not bother to return such details.
The fix is to ensure that, when no primary blog is available, we pull the new primary blog's full details from get_blog_details(), rather than relying on the object we already have.
On the next call to get_active_blog_for_user(), primary_blog will be set, so the function call only affects first-run situations.