Action uncanny-learndash-toolkit

uo_forgot_before_form

Fires before the User Onboarding forgot password form is displayed.

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

Description

Fires before the password recovery form is displayed. Developers can use this hook to add custom content, fields, or modify the form's structure. It's an ideal place to inject additional validation or instructions before the user submits their recovery request.


Usage

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

Examples

add_action( 'uo_forgot_before_form', 'my_custom_forgot_password_message', 10 );

/**
 * Adds a custom message before the password recovery form.
 * This function is hooked into the 'uo_forgot_before_form' action.
 *
 * @since 1.0.0
 */
function my_custom_forgot_password_message() {
	// Check if the current user is logged in. If so, they shouldn't see the forgot password form.
	if ( is_user_logged_in() ) {
		echo '<p class="ult-form__notice">' . esc_html__( 'You are already logged in. If you need to reset your password, please log out first.', 'your-text-domain' ) . '</p>';
		return; // Exit the function early if the user is logged in.
	}

	// Display a helpful message for users who might be confused.
	echo '<p class="ult-form__instructions">' . esc_html__( 'Please enter your username or email address below. You will receive a link to create a new password via email.', 'your-text-domain' ) . '</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:75
src/templates/frontend-login/layout_1-lost-pwd.php:68

<?php
						if ( ! isset( $forgot_password_response ) ) {
							echo $innerText['Password-Recovery-Desc'];
						}
						?>
					</div>
					
					<?php do_action( 'uo_forgot_before_form' ); ?>

					<div class="ult-form__container">

						<form id="ult-forgot-password-form" name="lostpasswordform" action="<?php echo site_url( 'wp-login.php?action=lostpassword', 'login_post' ); ?>" method="POST">

							<input type="hidden" name="redirect_to" value="<?php echo $login_page_url . ( strpos( $login_page_url, '?' ) ? '&' : '?' ); ?>action=forgot&success=1">


Scroll to Top