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

WordPress Trac noreply at wordpress.org
Fri May 27 18:33:33 UTC 2016


#36961: wp_roles displays incorrect roles in multisite
-----------------------------+------------------------------
 Reporter:  ryanduff         |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Role/Capability  |     Version:  4.2
 Severity:  normal           |  Resolution:
 Keywords:  dev-feedback     |     Focuses:  multisite
-----------------------------+------------------------------

Comment (by ryanduff):

 I'll also add that while I later discovered this resulted a bug in network
 admin, I first noticed it when trying to get and display a user's role on
 another site in a multisite install via the following method:


 {{{
 $user = new WP_User( $user_id, '', $site_id );
 $role = reset( $user->roles );
 }}}

 If that runs on the $site_id I'm checking the correct role is displayed.
 However, if I'm on site 2, and pass in 3 as $site_id, I get an empty array
 back.

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


More information about the wp-trac mailing list