[wp-trac] [WordPress Trac] #25128: Remove unreachable code in get_active_blog_for_user()

WordPress Trac noreply at wordpress.org
Fri Aug 23 18:05:16 UTC 2013


#25128: Remove unreachable code in get_active_blog_for_user()
--------------------------+-----------------------
 Reporter:  jeremyfelt    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.7
Component:  Multisite     |    Version:  3.0
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------
 `get_active_blog_for_user()` accounts for a case where `get_user_meta(
 $user_id, 'primary_blog', true );` returns `false`. I believe the only
 possible way for this to happen is via a misguided filter on
 `get_user_metadata`.

 If for some reason `false` was returned, the existing code sets the user
 as a subscriber on the first site it finds the user has access to,
 overwriting any existing capabilities. (See also #15316)

 The function then returns a blog object that may not meet the full
 expectations of a blog object being returned by the function. (See also
 #18789)

 The attached patch removes this extra, unnecessary code.

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


More information about the wp-trac mailing list