uo_forgot_after_error_message
Fires after an error message is displayed during the forgot password process.
add_action( 'uo_forgot_after_error_message', $callback, 10, 1 );
Description
Fires after an error message is displayed on the "Forgot Password" page. Developers can use this hook to add custom content, modify the error message display, or trigger additional actions when a password reset error occurs.
Usage
add_action( 'uo_forgot_after_error_message', 'your_function_name', 10, 1 );
Examples
add_action( 'uo_forgot_after_error_message', 'my_custom_forgot_password_error_handling', 10 );
/**
* Custom handling for the 'uo_forgot_after_error_message' hook.
*
* This function demonstrates how to add custom logic after an error message
* is displayed in the 'forgot password' form. In this example, we'll log
* the error message to the WordPress debug log for administrative review.
*
* @since 1.0.0
*/
function my_custom_forgot_password_error_handling() {
// Check if the global $forgot_password_response variable is set and if it has a message.
// In a real-world scenario, you might want to make sure this variable is available
// within the scope where this action is being fired, or pass relevant data to it.
global $forgot_password_response;
if ( isset( $forgot_password_response ) && is_object( $forgot_password_response ) && isset( $forgot_password_response->message ) && ! empty( $forgot_password_response->message ) ) {
// Log the error message for debugging purposes.
// This is useful for administrators to track potential issues with the forgot password process.
error_log( sprintf( 'UO Forgot Password Error: %s', sanitize_text_field( $forgot_password_response->message ) ) );
// Optionally, you could perform other actions here, like sending an email
// to an administrator, incrementing an error counter, etc.
}
}
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:134
src/templates/frontend-login/layout_1-lost-pwd.php:127
<div class="ult-form__validation <?php echo implode( ' ', $notice_css_classes ); ?>">
<div class="ult-notice ult-notice--error">
<?php do_action( 'uo_forgot_before_error_message' ); ?>
<span class="ult-notice-text"><?php echo isset( $forgot_password_response->message ) ? $forgot_password_response->message : ''; ?></span>
<?php do_action( 'uo_forgot_after_error_message' ); ?>
</div>
</div>
<?php do_action( 'uo_forgot_before_submit' ); ?>
<div class="ult-form__row ult-form__row--submit">
<button type="submit" id="ult-forgot-password-submit-btn" class="ult-form__submit-btn">