Ticket #3152: 3152.diff

File 3152.diff, 4.9 KB (added by Nazgul, 6 years ago)
  • wp-admin/admin-db.php

     
    4747 
    4848        if ( ! $user->has_cap('edit_others_posts') ) { 
    4949                if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) 
    50                         return array($user->id); 
     50                        return array($user->ID); 
    5151                else  
    5252                        return false; 
    5353        } 
  • wp-admin/users.php

     
    136136                if ( ! current_user_can('edit_user', $id) ) 
    137137                        wp_die(__('You can’t edit that user.')); 
    138138                // The new role of the current user must also have edit_users caps 
    139                 if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) { 
     139                if($id == $current_user->ID && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) { 
    140140                        $update = 'err_admin_role'; 
    141141                        continue; 
    142142                } 
     
    168168                if ( ! current_user_can('delete_user', $id) ) 
    169169                        wp_die(__('You can’t delete that user.')); 
    170170 
    171                 if($id == $current_user->id) { 
     171                if($id == $current_user->ID) { 
    172172                        $update = 'err_admin_del'; 
    173173                        continue; 
    174174                } 
     
    214214        $go_delete = false; 
    215215        foreach ( (array) $userids as $id ) { 
    216216                $user = new WP_User($id); 
    217                 if ( $id == $current_user->id ) { 
     217                if ( $id == $current_user->ID ) { 
    218218                        echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n"; 
    219219                } else { 
    220220                        echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "</li>\n"; 
     
    224224        $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login"); 
    225225        $user_dropdown = '<select name="reassign_user">'; 
    226226        foreach ( (array) $all_logins as $login ) 
    227                 if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) ) 
     227                if ( $login->ID == $current_user->ID || !in_array($login->ID, $userids) ) 
    228228                        $user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>"; 
    229229        $user_dropdown .= '</select>'; 
    230230        ?> 
  • wp-includes/capabilities.php

     
    130130 
    131131class WP_User { 
    132132        var $data; 
    133         var $id = 0; 
     133        var $ID = 0; 
     134        var $id = 0; // Deprecated, use $ID instead. 
    134135        var $caps = array(); 
    135136        var $cap_key; 
    136137        var $roles = array(); 
     
    193194 
    194195        function add_role($role) { 
    195196                $this->caps[$role] = true; 
    196                 update_usermeta($this->id, $this->cap_key, $this->caps); 
     197                update_usermeta($this->ID, $this->cap_key, $this->caps); 
    197198                $this->get_role_caps(); 
    198199                $this->update_user_level_from_caps(); 
    199200        } 
     
    202203                if ( empty($this->roles[$role]) || (count($this->roles) <= 1) ) 
    203204                        return; 
    204205                unset($this->caps[$role]); 
    205                 update_usermeta($this->id, $this->cap_key, $this->caps); 
     206                update_usermeta($this->ID, $this->cap_key, $this->caps); 
    206207                $this->get_role_caps(); 
    207208        } 
    208209 
     
    215216                } else { 
    216217                        $this->roles = false; 
    217218                } 
    218                 update_usermeta($this->id, $this->cap_key, $this->caps); 
     219                update_usermeta($this->ID, $this->cap_key, $this->caps); 
    219220                $this->get_role_caps(); 
    220221                $this->update_user_level_from_caps(); 
    221222        } 
     
    232233        function update_user_level_from_caps() { 
    233234            global $wpdb; 
    234235            $this->user_level = array_reduce(array_keys($this->allcaps),        array(&$this, 'level_reduction'), 0); 
    235             update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level); 
     236            update_usermeta($this->ID, $wpdb->prefix.'user_level', $this->user_level); 
    236237        } 
    237238 
    238239        function add_cap($cap, $grant = true) { 
    239240                $this->caps[$cap] = $grant; 
    240                 update_usermeta($this->id, $this->cap_key, $this->caps); 
     241                update_usermeta($this->ID, $this->cap_key, $this->caps); 
    241242        } 
    242243 
    243244        function remove_cap($cap) { 
    244245                if ( empty($this->caps[$cap]) ) return; 
    245246                unset($this->caps[$cap]); 
    246                 update_usermeta($this->id, $this->cap_key, $this->caps); 
     247                update_usermeta($this->ID, $this->cap_key, $this->caps); 
    247248        } 
    248249 
    249250        function remove_all_caps() { 
    250251                global $wpdb; 
    251252                $this->caps = array(); 
    252                 update_usermeta($this->id, $this->cap_key, ''); 
    253                 update_usermeta($this->id, $wpdb->prefix.'user_level', ''); 
     253                update_usermeta($this->ID, $this->cap_key, ''); 
     254                update_usermeta($this->ID, $wpdb->prefix.'user_level', ''); 
    254255                $this->get_role_caps(); 
    255256        } 
    256257 
     
    261262                        $cap = $this->translate_level_to_cap($cap); 
    262263 
    263264                $args = array_slice(func_get_args(), 1); 
    264                 $args = array_merge(array($cap, $this->id), $args); 
     265                $args = array_merge(array($cap, $this->ID), $args); 
    265266                $caps = call_user_func_array('map_meta_cap', $args); 
    266267                // Must have ALL requested caps 
    267268                $capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args);