Capabilities fixes from the O man. fixes #1561

git-svn-id: http://svn.automattic.com/wordpress/trunk@2793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-08-20 01:37:41 +00:00
parent c58b95fe37
commit 3627bffe0e
1 changed files with 4 additions and 4 deletions

View File

@ -64,7 +64,7 @@ class WP_Roles {
function is_role($role)
{
return empty($this->role_names[$role]);
return isset($this->role_names[$role]);
}
}
@ -132,11 +132,11 @@ class WP_User {
global $wp_roles;
//Filter out caps that are not role names and assign to $this->roles
if(is_array($this->caps))
$this->roles = array_filter($this->caps, array(&$wp_roles, 'is_role'));
$this->roles = array_filter(array_keys($this->caps), array(&$wp_roles, 'is_role'));
//Build $allcaps from role caps, overlay user's $caps
$this->allcaps = array();
foreach($this->roles as $role => $value) {
foreach($this->roles as $role) {
$role = $wp_roles->get_role($role);
$this->allcaps = array_merge($this->allcaps, $role->capabilities);
}
@ -159,7 +159,7 @@ class WP_User {
}
function set_role($role) {
foreach($this->roles as $oldrole => $value)
foreach($this->roles as $oldrole)
unset($this->caps[$oldrole]);
$this->caps[$role] = true;
$this->roles = array($role => true);