From d908719c02ae6595d40745358e00b1fa90803025 Mon Sep 17 00:00:00 2001 From: Carl Alexander Date: Mon, 25 Nov 2024 14:19:58 -0500 Subject: [PATCH] feat: update `wp_set_password` function to match current wordpress version fixes #18 --- pluggable.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pluggable.php b/pluggable.php index 83ae331..9349431 100644 --- a/pluggable.php +++ b/pluggable.php @@ -92,10 +92,15 @@ function wp_set_password($password, $user_id) { global $wpdb; - $hash = wp_hash_password($password); + $old_user_data = get_userdata($user_id); + + $hash = wp_hash_password( $password ); + $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id)); - wp_cache_delete($user_id, 'users'); + clean_user_cache($user_id); + + do_action('wp_set_password', $password, $user_id, $old_user_data); return $hash; }