diff --git a/core/um-actions-account.php b/core/um-actions-account.php index 4b99d170..fabe8831 100644 --- a/core/um-actions-account.php +++ b/core/um-actions-account.php @@ -9,6 +9,8 @@ if ( $_POST['user_password'] && $_POST['confirm_user_password'] ) { $changes['user_pass'] = $_POST['user_password']; + add_filter('send_password_change_email','um_send_password_change_email'); + } foreach( $_POST as $k => $v ) { diff --git a/core/um-actions-password.php b/core/um-actions-password.php index c5ab49ca..a6e1ad3d 100644 --- a/core/um-actions-password.php +++ b/core/um-actions-password.php @@ -34,14 +34,16 @@ add_action('um_change_password_process_hook','um_change_password_process_hook'); function um_change_password_process_hook( $args ) { global $ultimatemember; + extract( $args ); wp_set_password( $args['user_password'], $args['user_id'] ); delete_user_meta( $args['user_id'], 'reset_pass_hash'); delete_user_meta( $args['user_id'], 'reset_pass_hash_token'); - + do_action('um_after_changing_user_password', $args['user_id'] ); + if ( is_user_logged_in() ) { wp_logout(); } @@ -50,17 +52,31 @@ } + /** + * Overrides password changed notification + * + */ + function um_send_password_change_email( $args ){ + + global $ultimatemember; + + um_fetch_user( $user_id ); + + $ultimatemember->user->password_changed(); + + um_reset_user(); + + + return false; + } + /*** *** @This is executed after changing password ***/ add_action('um_after_changing_user_password','um_after_changing_user_password'); function um_after_changing_user_password( $user_id ) { global $ultimatemember; - um_fetch_user( $user_id ); - - $ultimatemember->mail->send( um_user('user_email'), 'changedpw_email' ); - - um_reset_user(); + } /*** diff --git a/core/um-short-functions.php b/core/um-short-functions.php index 56e32b71..dd4b4b76 100644 --- a/core/um-short-functions.php +++ b/core/um-short-functions.php @@ -610,7 +610,8 @@ function um_profile_id() { ***/ function um_requesting_password_change() { global $post, $ultimatemember; - if ( um_is_core_page('password-reset') && isset( $_POST['_um_password_change'] ) == 1 ) + + if ( um_is_core_page('account') && isset( $_POST['_um_account'] ) == 1 ) return true; return false; } @@ -1353,3 +1354,4 @@ function um_user( $data, $attrs = null ) { } } + diff --git a/core/um-user.php b/core/um-user.php index c503ac4b..250503cd 100644 --- a/core/um-user.php +++ b/core/um-user.php @@ -434,6 +434,15 @@ class UM_User { $this->password_reset_hash(); $ultimatemember->mail->send( um_user('user_email'), 'resetpw_email' ); } + + + /*** + *** @password changed email + ***/ + function password_changed(){ + global $ultimatemember; + $ultimatemember->mail->send( um_user('user_email'), 'changedpw_email' ); + } /** * @function approve()