[wp-testers] 2.0.2 Release Candidate 1

Ryan Boren ryan at boren.nu
Wed Mar 8 02:09:33 GMT 2006


Owen Winkler wrote:
> These might be useful:
> 
> function get_internal_role_names() {
>     global $wp_roles;
> 
>     if ( ! isset($wp_roles) )
>         $wp_roles = new WP_Roles();
> 
>     return array_keys($wp_roles->role_names);
> }
> 
> function add_matching_cap($has_cap, $new_cap) {
>     global $wp_roles;
> 
>     if ( ! isset($wp_roles) )
>         $wp_roles = new WP_Roles();
> 
>     $new_cap_roles = array();
>     foreach($wp_roles->role_objects as $rolename => $role) {
>         if($role->has_cap($has_cap)) {
>             $role->add_cap($new_cap);
>             $new_cap_roles[] = $rolename;
>         }
>     }
>     return $new_cap_roles;
> }

I agree in principal with both of these.  Just need to agree on function 
names.  get_role_ids() and associate_caps() maybe.

Ryan


More information about the wp-testers mailing list