[wp-trac] [WordPress Trac] #10285: remove_role not working / code needs change

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 21 01:41:44 UTC 2010


#10285: remove_role not working / code needs change
-----------------------------+----------------------------------------------
 Reporter:  5ubliminal       |       Owner:  dd32                         
     Type:  defect (bug)     |      Status:  accepted                     
 Priority:  normal           |   Milestone:  3.0                          
Component:  Role/Capability  |     Version:  2.8                          
 Severity:  normal           |    Keywords:  roles has-patch needs-testing
-----------------------------+----------------------------------------------
Changes (by dd32):

  * owner:  => dd32
  * status:  assigned => accepted


Comment:

 Can those affected please test with the changes in that last commit there?

 Here's the code i've used for testing purposes:

 {{{
 add_role('test', 'Test Role');
 $role =& get_role('test');
 $role->add_cap('test_cap_here');

 $user = new WP_User('test');

 $before = $user->allcaps;

 $user->add_role('test');
 $user->remove_role('test');

 var_Dump( $before == $user->allcaps );

 remove_role('test');

 }}}

 Should display "true" for success, "False" for failure. If it fails, the
 next iteration will fail too, but the 3rd will succeed.

 As a side note, the user_level was not being set upon role removal, So it
 could lead to a higher level being set incorrectly.. User levels are
 deprecated and no-one should be relying on them however.

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


More information about the wp-trac mailing list