uo_login_before_forgot_password
Fires before the user's password reset email is sent, allowing for customization or cancellation.
add_action( 'uo_login_before_forgot_password', $callback, 10, 1 );
Description
Fires before the "Forgot Password" link is displayed in the login form. Developers can use this hook to add custom content or modify the login form's footer structure just before the forgotten password link appears. It's a prime spot for adding auxiliary actions or information relevant to the login process.
Usage
add_action( 'uo_login_before_forgot_password', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Example function to hook into 'uo_login_before_forgot_password'.
*
* This function demonstrates how to add custom content or logic
* immediately before the 'Forgot Password' link in the login form.
* For instance, you might want to display a specific message or
* a link to a help article related to password recovery.
*
* @since 1.0.0
*/
function my_custom_uo_login_before_forgot_password_message() {
// Check if we are on a frontend login page context and if the user is not logged in.
// This is a hypothetical check, the actual context might require different checks.
if ( is_user_logged_in() ) {
return; // Do nothing if the user is already logged in.
}
// Display a custom message or link before the forgot password link.
?>
<p class="ult-form-footer__custom-message" style="margin-bottom: 10px; font-size: 0.9em; color: #666;">
Having trouble? <a href="/support/password-recovery-help/" title="Password Recovery Help">Get help</a> with your password.
</p>
<?php
}
// Add the custom function to the 'uo_login_before_forgot_password' action hook.
// The '10' is the default priority, and '0' indicates no arguments are accepted by the callback.
add_action( 'uo_login_before_forgot_password', 'my_custom_uo_login_before_forgot_password_message', 10, 0 );
?>
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/layout_1-login.php:208
src/templates/frontend-login/modern_ui-login.php:215
<?php do_action( 'uo_login_before_footer' ); ?>
</div>
<div class="ult-form__footer">
<?php do_action( 'uo_login_before_forgot_password' ); ?>
<div class="ult-form-footer__forgot-password">
<a id="ult-form-footer-forgot-password" href="<?php echo $login->urls->forgot_password; ?>">
<?php echo $login->strings->forgot_password; ?>
</a>
</div>