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

WordPress Trac noreply at wordpress.org
Mon Sep 11 18:12:45 UTC 2017


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

Comment (by jeremyfelt):

 Replying to [comment:22 flixos90]:
 > [attachment:36961.8.diff] brings back the `__call()` method to be more
 backward-compatible.
 >
 > @jeremyfelt
 > > When called from site 1, `new WP_User( $user_id, '', 2 )` provides a
 user object that contains only roles assigned to the user that exist on
 both site 1 and 2. This is primarily because `wp_roles()` is used to
 populate available roles without switching site context.
 >
 > Not sure I understand. I think the site context is switched, see
 `get_role_caps()`. Or do you mean something else?

 Sorry, I meant in its current state, pre-patch. The patch fixes the issue.
 :)

 > Regarding [attachment:36961.7.diff], `wp_get_users_with_no_role()` and
 `count_users()`, I think all of these should be dealt with through
 separate tickets that can be merged shortly after this one and #38645.
 Some of the fixes might also be based on the improved foundation that
 #38645 will introduce.

 I'm okay with that.

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


More information about the wp-trac mailing list