[wp-trac] [WordPress Trac] #31878: get_users() on multisite returns empty user roles when other blog_id provided

WordPress Trac noreply at wordpress.org
Fri Apr 3 13:57:19 UTC 2015


#31878: get_users() on multisite returns empty user roles when other blog_id
provided
--------------------------+------------------------
 Reporter:  Kubitomakita  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.2
Component:  Users         |     Version:  3.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  multisite
--------------------------+------------------------
Changes (by boonebgorges):

 * version:  4.1.1 => 3.5
 * milestone:  Awaiting Review => 4.2


Comment:

 Thanks for the report.

 I've confirmed the issue. The problem is not that `'roles'` is *empty* per
 se, it's that roles/caps are being populated from the wrong site in some
 cases (and in your situation, the user doesn't have any role at all on the
 current site). In [15566], `WP_User_Query` was modified to ensure that
 caps are fetched from the proper 'blog_id'; in [22248], `WP_User_Query`
 was modified to return `WP_User` objects when 'fields=all', but the
 blog_id fix from [15566] was not included in the latter changeset.

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


More information about the wp-trac mailing list