uo_reset_before_error_message
Fires before an error message is displayed during the user reset process.
add_action( 'uo_reset_before_error_message', $callback, 10, 1 );
Description
Fires just before the password reset error message is displayed. Developers can use this hook to add custom content or modify the error display logic for password reset operations.
Usage
add_action( 'uo_reset_before_error_message', 'your_function_name', 10, 1 );
Examples
add_action( 'uo_reset_before_error_message', 'my_uo_reset_display_custom_error_note', 10, 0 );
/**
* Displays a custom note before the actual error message on the password reset form.
* This can be used to provide additional context or guidance to the user
* based on the type of error encountered.
*/
function my_uo_reset_display_custom_error_note() {
// In a real-world scenario, you might check a global variable or a transient
// to determine if a specific type of error occurred and then display a tailored message.
// For this example, we'll just display a generic informational message.
// Example: Check if the error is specifically due to an invalid token.
// This would require accessing the '$error' variable, which is not directly passed to this hook.
// A more robust solution might involve passing such context via other means or within the $error variable itself.
// For now, let's assume we want to display a general helpful hint.
// If you had access to the specific error type, you could do something like:
// global $uo_reset_error_type; // Assuming you've set this elsewhere
// if ( isset( $uo_reset_error_type ) && 'invalid_token' === $uo_reset_error_type ) {
// echo '<p class="uo-reset-error-hint">The reset link you provided has expired or is invalid. Please request a new one.</p>';
// } else {
// echo '<p class="uo-reset-error-hint">Please check the details below and try again.</p>';
// }
// For a simpler, general note:
echo '<p class="uo-reset-error-hint">Please carefully review the error message below.</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/default-reset-pwd.php:16
src/templates/frontend-login/modern_ui-reset-pwd.php:117
src/templates/frontend-login/layout_1-reset-pwd.php:110
<?php do_action( 'uo_reset_before_description' ); ?>
<p><?php echo $innerText['Reset-Password-Desc']; ?></p>
<?php do_action( 'uo_reset_before_form' ); ?>
<form name="resetpassform" id="resetpassform" action="?action=validatepasswordreset" method="post" autocomplete="off">
<?php if ( ! empty( $error ) ) { ?>
<?php do_action( 'uo_reset_before_error' ); ?>
<p>
<?php do_action( 'uo_reset_before_error_message' ); ?>
<?php echo $error; ?>
<?php do_action( 'uo_reset_after_error_message' ); ?>
</p>
<?php } ?>
<input type="hidden" id="user_login" name="rp_login" value="<?php echo esc_attr( $rp_login ); ?>"
autocomplete="off"/>