Capabilities fixes from the O man. fixes #1561

git-svn-id: https://develop.svn.wordpress.org/trunk@2793 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-08-20 01:37:41 +00:00
parent 856458343e
commit 720b7c5d36
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);