[wp-trac] [WordPress Trac] #36961: wp_roles displays incorrect roles in multisite

WordPress Trac noreply at wordpress.org
Fri Sep 23 08:57:42 UTC 2016


#36961: wp_roles displays incorrect roles in multisite
-------------------------------------------------+-------------------------
 Reporter:  ryanduff                             |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Role/Capability                      |  Release
 Severity:  normal                               |     Version:  4.2
 Keywords:  dev-feedback has-patch needs-unit-   |  Resolution:
  tests                                          |     Focuses:  multisite
-------------------------------------------------+-------------------------
Changes (by flixos90):

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


Comment:

 [attachment:36961.diff] should fix the problem by switching the site if
 necessary and then retrieving the roles while in switched state.

 The patch can probably be improved, especially my initial logic to extract
 the site ID out of the `$cap_key` property is a bit sloppy. Not sure if we
 should actually store the site ID as property in `WP_User` instead. If we
 did that, we could possibly run into sync issues between the site ID and
 the cap key (which should reference to the same site ID).

 Unit tests need to be added as well.

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


More information about the wp-trac mailing list