Make WordPress Core


Ignore:
Timestamp:
06/10/2006 08:26:26 PM (18 years ago)
Author:
ryan
Message:

Better handling of users with no role. Props Mark Jaquith. #2809

File:
1 edited

Legend:

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

    r3846 r3859  
    175175        //Build $allcaps from role caps, overlay user's $caps
    176176        $this->allcaps = array();
    177         foreach($this->roles as $role) {
     177        foreach( (array) $this->roles as $role) {
    178178            $role = $wp_roles->get_role($role);
    179179            $this->allcaps = array_merge($this->allcaps, $role->capabilities);
     
    200200        foreach($this->roles as $oldrole)
    201201            unset($this->caps[$oldrole]);
    202         $this->caps[$role] = true;
    203         $this->roles = array($role => true);
     202        if ( !empty($role) ) {
     203            $this->caps[$role] = true;
     204            $this->roles = array($role => true);
     205        } else {
     206            $this->roles = false;
     207        }
    204208        update_usermeta($this->id, $this->cap_key, $this->caps);
    205209        $this->get_role_caps();
Note: See TracChangeset for help on using the changeset viewer.