From 0f125a01bf48ed4c6dc3802db612e4fff2cc9b54 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pluggable.php b/pluggable.php index 83ae331..4063c5b 100644 --- a/pluggable.php +++ b/pluggable.php @@ -92,10 +92,15 @@ function wp_set_password($password, $user_id) { global $wpdb; + $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; }