[wp-hackers] select all users with role X

Owen Winkler ringmaster at midnightcircus.com
Tue Dec 27 22:57:32 GMT 2005


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.

Owen


More information about the wp-hackers mailing list