Action uncanny-learndash-toolkit

uo_forgot_before_title

Fires before the title is displayed on the WordPress forgotten password page, allowing for modifications.

add_action( 'uo_forgot_before_title', $callback, 10, 1 );

Description

Fires before the "Forgot Password" title is displayed on the lost password page. This hook allows developers to inject custom content or modify the title context before it's rendered. It's particularly useful for adding introductory text, custom elements, or conditional logic before the main title.


Usage

add_action( 'uo_forgot_before_title', 'your_function_name', 10, 1 );

Examples

<?php
/**
 * Example function to hook into 'uo_forgot_before_title' action.
 * This function adds an extra heading or introductory text before the main title
 * on the password recovery form, but only if the user has already submitted
 * the form and there were no errors.
 *
 * @since 1.0.0
 */
function my_custom_forgot_password_intro_text() {
    // This action hook is called within a conditional block that checks if
    // $forgot_password_response is set and doesn't contain an error.
    // Therefore, we can assume this code will only run after a submission attempt.

    // Let's add a friendly message to guide the user, assuming the email was sent.
    // In a real scenario, you might fetch this text from a theme option or
    // a custom plugin setting for better maintainability.
    $intro_message = __( 'Please check your inbox for a password reset link.', 'my-text-domain' );

    // Only display if there's a response and no error, which is handled by the surrounding PHP.
    // The structure of the hook placement in the template files implies this.
    echo '<p class="ult-form__intro-message" style="margin-bottom: 10px; color: #555;">' . esc_html( $intro_message ) . '</p>';
}

// Add the action to WordPress.
// The 'uo_forgot_before_title' hook likely doesn't pass any arguments to the callback function.
// Therefore, we specify 1 accepted argument.
add_action( 'uo_forgot_before_title', 'my_custom_forgot_password_intro_text', 10, 1 );

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:39
src/templates/frontend-login/modern_ui-lost-pwd.php:59
src/templates/frontend-login/layout_1-lost-pwd.php:32
src/templates/frontend-login/layout_1-lost-pwd.php:52
src/classes/frontend-login-plus.php:3544

* successful then we shouldn't show the fields again, only
				 * the success message
				 */

				if ( isset( $forgot_password_response ) && ! $forgot_password_response->error ) {
					?>
					
					<?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' ); ?>


Scroll to Top