[wp-trac] [WordPress Trac] #37061: Use `get_sites()` in `get_blogs_of_user()`

WordPress Trac noreply at wordpress.org
Thu Jun 9 09:59:24 UTC 2016


#37061: Use `get_sites()` in `get_blogs_of_user()`
--------------------------------+-----------------------------
 Reporter:  flixos90            |      Owner:
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  trunk
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 Now that we have `get_sites()` merged (see #35791), we should use this
 function in `get_blogs_of_user()`. By adjusting this...

 * the function would only need to find the site IDs of that user and then
 make a query using `get_sites()` and the `site__in` argument (plus
 additional arguments for non-archived/non-spam/non-deleted if `$all` is
 false)
 * the function would then return an array of proper `WP_Site` objects
 instead of an array of `stdClass`

 We should probably wait for #36717 and #36935 to be completed and merged
 first before we start playing around with a patch here. By that...

 * we'd no longer need to use `get_blog_details()`
 * we could add `userblog_id` as a magic property in `WP_Site` that returns
 `$blog_id` as an integer

 This should keep it backwards-compatible and make the function a lot less
 cluttered.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37061>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list