uo_forgot_before_success
Fires just before the password reset email is successfully sent to the user.
add_action( 'uo_forgot_before_success', $callback, 10, 1 );
Description
Fires before displaying the success message on the password recovery form. Developers can use this hook to perform actions immediately before the success message is shown, such as logging data or triggering other processes. This hook has no parameters.
Usage
add_action( 'uo_forgot_before_success', 'your_function_name', 10, 1 );
Examples
add_action( 'uo_forgot_before_success', 'my_custom_uo_forgot_before_success_logic', 10, 0 );
/**
* Logs a message to the debug log when the forgot password process is about to display a success message.
* This can be useful for tracking when the success state is reached and for debugging potential issues.
*/
function my_custom_uo_forgot_before_success_logic() {
// Check if WP_DEBUG is enabled and we're in a debugging environment to avoid unnecessary logging.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( 'User is about to see the forgot password success message.' );
// Example: You could also conditionally add other elements or modify existing ones here
// based on user roles or other conditions, though for this hook, it's primarily for
// before the success message is rendered.
// For instance, if you wanted to display a special note for administrators:
/*
if ( current_user_can( 'manage_options' ) ) {
echo '<p class="admin-note">Administrators are performing password resets.</p>';
}
*/
}
}
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/modern_ui-lost-pwd.php:45
src/templates/frontend-login/layout_1-lost-pwd.php:38
src/classes/frontend-login-plus.php:3550
<?php do_action( 'uo_forgot_before_title' ); ?>
<div class="ult-form__title">
<?php echo $innerText['Password-Recovery-Title']; ?>
</div>
<?php do_action( 'uo_forgot_before_success' ); ?>
<div class="ult-form__row ult-form__row--validation">
<div class="ult-notice ult-notice--success">
<?php do_action( 'uo_forgot_before_success_message' ); ?>
<?php echo $forgot_password_response->message; ?>
<?php do_action( 'uo_forgot_after_success_message' ); ?>
</div>