role_has_cap and user_has_cap filters from ringmaster. fixes #2005
git-svn-id: http://svn.automattic.com/wordpress/trunk@3296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ece625403c
commit
72650ed6b7
|
@ -97,8 +97,9 @@ class WP_Role {
|
||||||
}
|
}
|
||||||
|
|
||||||
function has_cap($cap) {
|
function has_cap($cap) {
|
||||||
if ( !empty($this->capabilities[$cap]) )
|
$capabilities = apply_filters('role_has_cap', $this->capabilities, $cap, $this->name);
|
||||||
return $this->capabilities[$cap];
|
if ( !empty($capabilities[$cap]) )
|
||||||
|
return $capabilities[$cap];
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -215,9 +216,10 @@ class WP_User {
|
||||||
$args = array_merge(array($cap, $this->id), $args);
|
$args = array_merge(array($cap, $this->id), $args);
|
||||||
$caps = call_user_func_array('map_meta_cap', $args);
|
$caps = call_user_func_array('map_meta_cap', $args);
|
||||||
// Must have ALL requested caps
|
// Must have ALL requested caps
|
||||||
|
$capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args);
|
||||||
foreach ($caps as $cap) {
|
foreach ($caps as $cap) {
|
||||||
//echo "Checking cap $cap<br/>";
|
//echo "Checking cap $cap<br/>";
|
||||||
if(empty($this->allcaps[$cap]) || !$this->allcaps[$cap])
|
if(empty($capabilities[$cap]) || !$capabilities[$cap])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue