Instead of using the Default WP reset password form, I'm creating my own and I'm stumped on this prepared statement.
I'm trying to update the user's password by checking their user_login and user_activation_key. When I run this query and echo the result, I'm getting a return of int(0). It seems like it's not returning any row of the user.
I also echo each POST variables to make sure it's the values are correct and it is so I'm not sure where the problem lies.
$newpassword = $_POST['newpass'];
$wp_hasher = new PasswordHash(16, FALSE);
$hashedPwd = wp_hash_password($newpassword);
$useremail = $_POST['useremail'];
$key = $_POST['key'];
$resetQuery = $wpdb -> query($wpdb -> prepare("UPDATE wp_users SET user_pass = %s, user_activation_key = '' WHERE user_login = %s AND user_activation_key = %s",
$hashedPwd, $useremail, $key));
If anyone can please help me, that would be great! Thanks.
wp_update_user
can do this.