From 407d212745657915e38c562a54d9f108886c1cfe Mon Sep 17 00:00:00 2001 From: denisbaranov Date: Wed, 6 Mar 2019 19:44:33 +0200 Subject: [PATCH] Fix: "um_after_changing_user_password" running before password has changed Link: https://github.com/ultimatemember/ultimatemember/issues/532 --- includes/core/class-password.php | 41 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/includes/core/class-password.php b/includes/core/class-password.php index f7fb8ef0..5ef2d47e 100644 --- a/includes/core/class-password.php +++ b/includes/core/class-password.php @@ -568,26 +568,6 @@ if ( ! class_exists( 'um\core\Password' ) ) { extract( $args ); if ( isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1 ) { - /** - * UM hook - * - * @type action - * @title um_after_changing_user_password - * @description Hook that runs after user change their password - * @input_vars - * [{"var":"$user_id","type":"int","desc":"User ID"}] - * @change_log - * ["Since: 2.0"] - * @usage add_action( 'um_after_changing_user_password', 'function_name', 10, 1 ); - * @example - * - */ - do_action( 'um_after_changing_user_password', $args['user_id'] ); $user = get_userdata( $args['user_id'] ); $errors = new \WP_Error(); @@ -613,6 +593,27 @@ if ( ! class_exists( 'um\core\Password' ) ) { wp_logout(); } + /** + * UM hook + * + * @type action + * @title um_after_changing_user_password + * @description Hook that runs after user change their password + * @input_vars + * [{"var":"$user_id","type":"int","desc":"User ID"}] + * @change_log + * ["Since: 2.0"] + * @usage add_action( 'um_after_changing_user_password', 'function_name', 10, 1 ); + * @example + * + */ + do_action( 'um_after_changing_user_password', $args['user_id'] ); + exit( wp_redirect( um_get_core_page('login', 'password_changed' ) ) ); } }