uo_forgot_before_description
Fires before displaying the description on the forgot password form.
add_action( 'uo_forgot_before_description', $callback, 10, 1 );
Description
Fires before the password recovery description is displayed in the 'lost password' form. Developers can use this action hook to inject custom content, modify the description, or perform actions just before the password recovery instructions are shown to the user.
Usage
add_action( 'uo_forgot_before_description', 'your_function_name', 10, 1 );
Examples
add_action( 'uo_forgot_before_description', 'my_custom_forgot_password_description', 10, 0 );
/**
* Adds a custom message before the password recovery description.
*
* This function demonstrates how to use the 'uo_forgot_before_description'
* action hook to insert custom content into the password recovery form.
*/
function my_custom_forgot_password_description() {
// Check if the current user is logged in. If so, display a different message.
if ( is_user_logged_in() ) {
echo '<p class="ult-form__custom-message">It looks like you're already logged in. If you need to change your password, please go to your <a href="' . esc_url( admin_url( 'profile.php' ) ) . '">profile page</a>.</p>';
} else {
// You could also add dynamic content here based on other conditions if needed.
echo '<p class="ult-form__custom-message">Please enter the email address associated with your account 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/modern_ui-lost-pwd.php:65
src/templates/frontend-login/layout_1-lost-pwd.php:58
<?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_description' ); ?>
<div class="ult-form__description">
<?php
if ( ! isset( $forgot_password_response ) ) {
echo $innerText['Password-Recovery-Desc'];
}
?>