From 720b7c5d36df07d019e4cc60def93e6f6f5bea11 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 20 Aug 2005 01:37:41 +0000 Subject: [PATCH] Capabilities fixes from the O man. fixes #1561 git-svn-id: https://develop.svn.wordpress.org/trunk@2793 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/capabilities.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index c8dfe56f02..90d2e95101 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -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);