[wp-trac] [WordPress Trac] #38430: Inconsistent return type in `get_active_blog_for_user()`

WordPress Trac noreply at wordpress.org
Thu Mar 30 05:21:20 UTC 2017


#38430: Inconsistent return type in `get_active_blog_for_user()`
--------------------------------+-----------------------------
 Reporter:  flixos90            |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Future Release
Component:  Networks and Sites  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  multisite
--------------------------------+-----------------------------
Changes (by jeremyfelt):

 * keywords:  needs-patch dev-feedback => has-patch
 * milestone:  Awaiting Review => Future Release


Comment:

 This statement should be reachable if the user's `primary_blog` happens to
 be set as archived, spam, or deleted.

 What I don't get is that we do another call to `get_blogs_of_user()` and
 pass the second parameter to get a list of all sites, including those set
 as archived, spam, or deleted. We then ignore those when trying to find a
 new primary to set for the user. That's probably another ticket.

 Quite a bit about this could be refactored, but [attachment:38430.diff] is
 pretty non-intrusive and should result in a consistent `WP_Site` return as
 we already have a better object available to us.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38430#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list