Make WordPress Core

Changeset 2793


Ignore:
Timestamp:
08/20/2005 01:37:41 AM (21 years ago)
Author:
ryan
Message:

Capabilities fixes from the O man. fixes #1561

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r2735 r2793  
    6565        function is_role($role)
    6666        {
    67                 return empty($this->role_names[$role]);
     67                return isset($this->role_names[$role]);
    6868        }       
    6969}
     
    133133                //Filter out caps that are not role names and assign to $this->roles
    134134                if(is_array($this->caps))
    135                         $this->roles = array_filter($this->caps, array(&$wp_roles, 'is_role'));
     135                        $this->roles = array_filter(array_keys($this->caps), array(&$wp_roles, 'is_role'));
    136136
    137137                //Build $allcaps from role caps, overlay user's $caps
    138138                $this->allcaps = array();
    139                 foreach($this->roles as $role => $value) {
     139                foreach($this->roles as $role) {
    140140                        $role = $wp_roles->get_role($role);
    141141                        $this->allcaps = array_merge($this->allcaps, $role->capabilities);
     
    160160       
    161161        function set_role($role) {
    162                 foreach($this->roles as $oldrole => $value)
     162                foreach($this->roles as $oldrole)
    163163                        unset($this->caps[$oldrole]);
    164164                $this->caps[$role] = true;
Note: See TracChangeset for help on using the changeset viewer.