[wp-trac] [WordPress Trac] #42014: Return correct role counts in `count_users()` when passing a different site ID

WordPress Trac noreply at wordpress.org
Wed Sep 27 22:02:21 UTC 2017


#42014: Return correct role counts in `count_users()` when passing a different site
ID
-----------------------------+------------------------------------------
 Reporter:  flixos90         |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  4.9
Component:  Role/Capability  |    Version:
 Severity:  normal           |   Keywords:  needs-patch needs-unit-tests
  Focuses:  multisite        |
-----------------------------+------------------------------------------
 When passing the `$site_id` parameter to `count_users()`, users for that
 site are counted. However, the available roles are still taken from the
 current site which is unexpected behavior.

 With the changes introduced in [41625], it is possible to easily switch
 the roles object over temporarily with `wp_roles->for_site( $site_id )`.
 This can be leveraged here to fix the bug in this function.

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


More information about the wp-trac mailing list