WordPress.org

Make WordPress Core

Changeset 12479


Ignore:
Timestamp:
12/22/09 11:42:46 (4 years ago)
Author:
westi
Message:

Ensure we don't destory the $wp_roles->role_objects property when assigning a second role to a WP_User object. Fixes #9128 props dd32.

File:
1 edited

Legend:

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

    r12332 r12479  
    9898     */ 
    9999    function _init () { 
    100         global $wpdb; 
    101         global $wp_user_roles; 
     100        global $wpdb, $wp_user_roles; 
    102101        $this->role_key = $wpdb->prefix . 'user_roles'; 
    103102        if ( ! empty( $wp_user_roles ) ) { 
     
    546545        $this->allcaps = array(); 
    547546        foreach ( (array) $this->roles as $role ) { 
    548             $role =& $wp_roles->get_role( $role ); 
    549             $this->allcaps = array_merge( (array) $this->allcaps, (array) $role->capabilities ); 
     547            $the_role =& $wp_roles->get_role( $role ); 
     548            $this->allcaps = array_merge( (array) $this->allcaps, (array) $the_role->capabilities ); 
    550549        } 
    551550        $this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps ); 
     
    653652        global $wpdb; 
    654653        $this->user_level = array_reduce( array_keys( $this->allcaps ), array( &$this, 'level_reduction' ), 0 ); 
    655         update_usermeta( $this->ID, $wpdb->prefix.'user_level', $this->user_level ); 
     654        update_usermeta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level ); 
    656655    } 
    657656 
     
    679678     */ 
    680679    function remove_cap( $cap ) { 
    681         if ( empty( $this->caps[$cap] ) ) return; 
     680        if ( empty( $this->caps[$cap] ) ) 
     681            return; 
    682682        unset( $this->caps[$cap] ); 
    683683        update_usermeta( $this->ID, $this->cap_key, $this->caps ); 
     
    694694        $this->caps = array(); 
    695695        update_usermeta( $this->ID, $this->cap_key, '' ); 
    696         update_usermeta( $this->ID, $wpdb->prefix.'user_level', '' ); 
     696        update_usermeta( $this->ID, $wpdb->prefix . 'user_level', '' ); 
    697697        $this->get_role_caps(); 
    698698    } 
     
    783783        } 
    784784 
    785         if ('' != $post->post_author) { 
     785        if ( '' != $post->post_author ) { 
    786786            $post_author_data = get_userdata( $post->post_author ); 
    787787        } else { 
Note: See TracChangeset for help on using the changeset viewer.