[wp-trac] [WordPress Trac] #23016: Allow plugins to manipulate WP_Roles ($wp_roles global) on construct

WordPress Trac noreply at wordpress.org
Thu Dec 20 10:31:26 UTC 2012


#23016: Allow plugins to manipulate WP_Roles ($wp_roles global) on construct
-----------------------------+------------------
 Reporter:  johnjamesjacoby  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  3.6
Component:  Role/Capability  |     Version:  3.5
 Severity:  normal           |  Resolution:
 Keywords:  early 3.6-early  |
-----------------------------+------------------

Comment (by TobiasBg):

 I recently stumbled upon a problem with WP_Roles, as well, when the user's
 caps where not refreshed after adding a cap to the user's role. See

 http://lists.automattic.com/pipermail/wp-hackers/2012-December/044927.html
 http://lists.automattic.com/pipermail/wp-hackers/2012-December/044933.html

 I ended up with refreshing this manually, although WP_Roles should
 probably take care of this by itself:
 {{{
 // Add or remove caps
 ...->add_cap( ... );
 // Refresh current set of capabilities of the user, to be able to directly
 use the new caps
 $user = wp_get_current_user();
 $user->get_role_caps();
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23016#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list