[wp-hackers] select all users with role X

Ryan Boren ryan at boren.nu
Tue Dec 27 23:11:54 GMT 2005

On Tue, 2005-12-27 at 17:57 -0500, Owen Winkler wrote:
> Ryan Boren wrote:
> > That's what I'm playing with right now, but it does not allow us to set
> > caps to false so that they can override inherited role caps.
> My suggestion is to use the metakey wp_caps_denied to override anything 
> in wp_caps_granted.  That is, capabilities that are explicitly denied to 
> a user would be added as additional row entries with the key 
> 'wp_caps_denied'.  Since these are assigned at the user level, they 
> would override anything in the role or user.
> Something like this around capabilities.php line 142:
> $caplist = $wpdb->get_col("SELECT meta_value FROM {$wpdb->usermeta} 
> WHERE meta_key = '{$wpdb->prefix}caps_granted'");
> foreach($caplist as $cap) $this->caps[$cap] = true;
> $caplist = $wpdb->get_col("SELECT meta_value FROM {$wpdb->usermeta} 
> WHERE meta_key = '{$wpdb->prefix}caps_denied'");
> foreach($caplist as $cap) $this->caps[$cap] = false;
> There's probably a cache of this data that should be used instead.

Sounds good.

I'm worn out right now.  If you or anyone else wants to implement this,
have at it.


More information about the wp-hackers mailing list