uo_reset_after_submit
Fires after the user reset password form has been submitted.
add_action( 'uo_reset_after_submit', $callback, 10, 1 );
Description
Fires after the password reset form is submitted and processed. Developers can use this hook to perform actions like sending follow-up emails, logging the reset event, or redirecting the user to a specific page after a successful reset.
Usage
add_action( 'uo_reset_after_submit', 'your_function_name', 10, 1 );
Examples
add_action( 'uo_reset_after_submit', 'my_custom_reset_password_confirmation', 10, 1 );
/**
* Displays a custom confirmation message after a password reset submission.
*
* This function hooks into the 'uo_reset_after_submit' action, which fires
* after the password reset form has been submitted. It can be used to display
* a success message, redirect the user, or perform other actions.
*
* @param WP_User|WP_Error $user_or_error The user object if the reset was successful, or a WP_Error object on failure.
*/
function my_custom_reset_password_confirmation( $user_or_error ) {
// Check if the password reset was successful
if ( ! is_wp_error( $user_or_error ) ) {
// Display a success message to the user
echo '<div class="updated notice"><p>' . __( 'Your password has been successfully reset. You can now <a href="' . wp_login_url() . '">login</a> with your new password.', 'your-text-domain' ) . '</p></div>';
// Optional: Redirect the user to the login page after a few seconds
// wp_redirect( wp_login_url() );
// exit;
} else {
// Display an error message if the reset failed
echo '<div class="error notice"><p>' . $user_or_error->get_error_message() . '</p></div>';
}
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/templates/frontend-login/default-reset-pwd.php:58
src/templates/frontend-login/modern_ui-reset-pwd.php:133
src/templates/frontend-login/layout_1-reset-pwd.php:126
<!-- <p class="description indicator-hint">--><?php /*echo $innerText['Password-Indicator-Hint'];*/ ?><!--</p>-->
<br class="clear"/>
<input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>"/>
<?php do_action( 'uo_reset_before_submit' ); ?>
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit"
class="button button-primary button-large"
value="<?php echo $innerText['Reset-Password-Button']; ?>"/></p>
<?php do_action( 'uo_reset_after_submit' ); ?>
</form>
<?php do_action( 'uo_reset_after_form' ); ?>
<?php do_action( 'uo_reset_after_container' ); ?>