[wp-trac] [WordPress Trac] #18789: get_active_blog_for_user() expects a more decorated blog object

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 27 07:35:48 UTC 2011


#18789: get_active_blog_for_user() expects a more decorated blog object
--------------------------+-----------------
 Reporter:  nacin         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.3
Component:  Multisite     |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18789>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list