mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
ID instead of id. Props Nazgul. fixes #3152
git-svn-id: http://svn.automattic.com/wordpress/trunk@4504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bb0d086933
commit
9a8391315a
@ -135,7 +135,7 @@ case 'promote':
|
||||
if ( ! current_user_can('edit_user', $id) )
|
||||
wp_die(__('You can’t edit that user.'));
|
||||
// The new role of the current user must also have edit_users caps
|
||||
if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) {
|
||||
if($id == $current_user->ID && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) {
|
||||
$update = 'err_admin_role';
|
||||
continue;
|
||||
}
|
||||
@ -169,7 +169,7 @@ case 'dodelete':
|
||||
if ( ! current_user_can('delete_user', $id) )
|
||||
wp_die(__('You can’t delete that user.'));
|
||||
|
||||
if($id == $current_user->id) {
|
||||
if($id == $current_user->ID) {
|
||||
$update = 'err_admin_del';
|
||||
continue;
|
||||
}
|
||||
@ -217,7 +217,7 @@ case 'delete':
|
||||
$go_delete = false;
|
||||
foreach ( (array) $userids as $id ) {
|
||||
$user = new WP_User($id);
|
||||
if ( $id == $current_user->id ) {
|
||||
if ( $id == $current_user->ID ) {
|
||||
echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
|
||||
} else {
|
||||
echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "</li>\n";
|
||||
@ -227,7 +227,7 @@ case 'delete':
|
||||
$all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
|
||||
$user_dropdown = '<select name="reassign_user">';
|
||||
foreach ( (array) $all_logins as $login )
|
||||
if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) )
|
||||
if ( $login->ID == $current_user->ID || !in_array($login->ID, $userids) )
|
||||
$user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
|
||||
$user_dropdown .= '</select>';
|
||||
?>
|
||||
|
@ -130,7 +130,8 @@ class WP_Role {
|
||||
|
||||
class WP_User {
|
||||
var $data;
|
||||
var $id = 0;
|
||||
var $ID = 0;
|
||||
var $id = 0; // Deprecated, use $ID instead.
|
||||
var $caps = array();
|
||||
var $cap_key;
|
||||
var $roles = array();
|
||||
@ -193,7 +194,7 @@ class WP_User {
|
||||
|
||||
function add_role($role) {
|
||||
$this->caps[$role] = true;
|
||||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
update_usermeta($this->ID, $this->cap_key, $this->caps);
|
||||
$this->get_role_caps();
|
||||
$this->update_user_level_from_caps();
|
||||
}
|
||||
@ -202,7 +203,7 @@ class WP_User {
|
||||
if ( empty($this->roles[$role]) || (count($this->roles) <= 1) )
|
||||
return;
|
||||
unset($this->caps[$role]);
|
||||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
update_usermeta($this->ID, $this->cap_key, $this->caps);
|
||||
$this->get_role_caps();
|
||||
}
|
||||
|
||||
@ -215,7 +216,7 @@ class WP_User {
|
||||
} else {
|
||||
$this->roles = false;
|
||||
}
|
||||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
update_usermeta($this->ID, $this->cap_key, $this->caps);
|
||||
$this->get_role_caps();
|
||||
$this->update_user_level_from_caps();
|
||||
}
|
||||
@ -261,7 +262,7 @@ class WP_User {
|
||||
$cap = $this->translate_level_to_cap($cap);
|
||||
|
||||
$args = array_slice(func_get_args(), 1);
|
||||
$args = array_merge(array($cap, $this->id), $args);
|
||||
$args = array_merge(array($cap, $this->ID), $args);
|
||||
$caps = call_user_func_array('map_meta_cap', $args);
|
||||
// Must have ALL requested caps
|
||||
$capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args);
|
||||
|
Loading…
Reference in New Issue
Block a user