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

WordPress Trac noreply at wordpress.org
Thu Aug 25 10:05:47 UTC 2016


#37061: Use `get_sites()` in `get_blogs_of_user()`
--------------------------------+------------------------
 Reporter:  flixos90            |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  4.7
Component:  Networks and Sites  |     Version:  4.6
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  multisite
--------------------------------+------------------------
Changes (by flixos90):

 * keywords:   => has-patch
 * milestone:  Awaiting Review => 4.7


Comment:

 [attachment:37061.diff] uses `get_sites()` in `get_blogs_of_user()` and
 gets rid of the juggling with raw objects. Since the objects use a
 property called `$userblog_id` (?), this property is now added as a magic
 property in `WP_Site` to remain compatible. `get_blog_details()` is no
 longer necessary either since these properties are lazy loaded
 automatically now (related: #37102).

 I also checked in Core where and how this function is used, and in no case
 is there any weird array transformation of objects that would cause
 problems with lazy-loaded properties. :)

 A minor issue is that on a non-multisite, the array will still contain a
 raw object since `WP_Site` is not available there, so one has to be aware
 of that. However, I still think we should do this as it's an improvement
 for Multisite setups.

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


More information about the wp-trac mailing list