Home › Forums › General Issues › User profile form: Update password? › Reply To: User profile form: Update password?
Aaaah, you biscuit 🙂
Sorted, thanks very much! Had to add a couple lines to update the user’s cookie so the password change doesn’t log them out immediately.
Here’s the final function that’s working for me:
add_filter('acf/pre_save_post', 'my_update_password');
function my_update_password($post_id) {
if (substr($post_id, 0 , 5) != 'user_') {
// not a user
return $post_id;
}
$new_password = $_POST['acf']['field_55c0cfff1d979']; // update this
$who = str_replace('user_', '', $post_id);
wp_set_password( $new_password, $who );
wp_clear_auth_cookie();
wp_set_current_user ( $who );
wp_set_auth_cookie ( $who );
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.