Action uncanny-learndash-toolkit

uo_forgot_before_login

Fires before initiating the password reset process, allowing customization of the login redirect.

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

Description

Fires before the "Forgot Password" form is submitted and processed. Developers can use this hook to perform actions like validating user input, logging attempts, or modifying data before the password reset process begins.


Usage

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

Examples

<?php
/**
 * Adds a custom message before the login link on the forgot password form.
 *
 * This function hooks into the 'uo_forgot_before_login' action to display a
 * helpful reminder to users that they can log in instead of resetting their password
 * if they remember it.
 *
 * @param array $args An array of arguments passed to the action hook.
 *                    Potentially includes user_id, form_type, etc. (though not used in this example).
 */
add_action( 'uo_forgot_before_login', function( $args = [] ) {
	// Check if the user is already logged in. If so, this message might be redundant.
	if ( is_user_logged_in() ) {
		return;
	}

	// Display a subtle message prompting users to log in if they remember their password.
	// The specific styling would be handled by CSS.
	echo '<p class="ult-form-footer__message" style="text-align: center; margin-bottom: 15px; font-size: 0.9em; color: #555;">';
	echo esc_html__( 'Already remember your password? You can log in directly!', 'your-text-domain' );
	echo '</p>';

}, 10, 1 ); // Priority 10, accepts 1 argument.

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-reset-pwd.php:141
src/templates/frontend-login/modern_ui-lost-pwd.php:159
src/templates/frontend-login/layout_1-reset-pwd.php:134
src/templates/frontend-login/layout_1-lost-pwd.php:152

</form>

			</div>
			
		</div>

		<div class="ult-form__footer">
			<?php do_action( 'uo_forgot_before_login' ); ?>

			<div class="ult-form-footer__login">
				<a id="ult-form-footer-login" href="<?php echo $login_page_url; ?>">
					<?php echo $innerText[ 'Log-in-instead' ]; ?>
				</a>
			</div>
		</div>


Scroll to Top