[wp-trac] [WordPress Trac] #16617: Bulk activate plugins: add capabilities with WP_Roles::add_cap() fails, while procedural add_cap() does not

WordPress Trac wp-trac at lists.automattic.com
Wed Feb 23 12:13:19 UTC 2011


#16617: Bulk activate plugins: add capabilities with WP_Roles::add_cap() fails,
while procedural add_cap() does not
-----------------------------+------------------------------
 Reporter:  jrfoell          |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Role/Capability  |     Version:  3.0.5
 Severity:  normal           |  Resolution:
 Keywords:  close            |
-----------------------------+------------------------------
Changes (by solarissmoke):

 * keywords:   => close


Comment:

 I think this is a case of incorrect usage. The OO plugin functions should
 do exactly what the procedural ones do - i.e., let wordpress handle it:

 {{{
 public function onActivation() {
         $role = get_role( 'administrator' );
         $role->add_cap( 'add_cap_oo' );
 }

 public function onDeactivation() {
         $role = get_role( 'administrator' );
         $role->remove_cap( 'add_cap_oo' );
 }
 }}}

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


More information about the wp-trac mailing list