Make sure user_login keyed caches are cleared upon change.
git-svn-id: http://svn.automattic.com/wordpress/trunk@3254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7fc3f04fc1
commit
9de108b9bf
|
@ -210,6 +210,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
|||
global $wpdb;
|
||||
|
||||
$id = (int) $id;
|
||||
$user = get_userdata($id);
|
||||
|
||||
if ($reassign == 'novalue') {
|
||||
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
|
||||
|
@ -239,7 +240,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
|||
$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
|
||||
|
||||
wp_cache_delete($id, 'users');
|
||||
// TODO: Need to delete username keyed cache object.
|
||||
wp_cache_delete($user->user_login, 'users');
|
||||
|
||||
do_action('delete_user', $id);
|
||||
|
||||
|
|
|
@ -2138,13 +2138,17 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
|
|||
$wpdb->query("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value )
|
||||
VALUES
|
||||
( '$user_id', '$meta_key', '$meta_value' )");
|
||||
return true;
|
||||
}
|
||||
if ( $cur->meta_value != $meta_value )
|
||||
} else if ( $cur->meta_value != $meta_value ) {
|
||||
$wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = get_userdata($user_id);
|
||||
wp_cache_delete($user_id, 'users');
|
||||
// FIXME: Need to delete username keyed cache object.
|
||||
wp_cache_delete($user->user_login, 'users');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
|
||||
|
@ -2162,8 +2166,11 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
|
|||
else
|
||||
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
|
||||
|
||||
$user = get_userdata($user_id);
|
||||
wp_cache_delete($user_id, 'users');
|
||||
// FIXME: Need to delete username keyed cache object.
|
||||
wp_cache_delete($user->user_login, 'users');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function register_activation_hook($file, $function) {
|
||||
|
|
Loading…
Reference in New Issue