Action uncanny-learndash-toolkit

after_uo_login_ui

Fires after the user login UI is displayed, allowing modification of the login form elements and states.

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

Description

Fires after the default WordPress user login UI has been rendered. Developers can use this hook to add custom content, modify existing elements, or perform actions after the login form, password reset, or registration UI is displayed. Passes several boolean flags indicating the current state of password reset and registration processes.


Usage

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

Examples

add_action( 'after_uo_login_ui', 'my_custom_login_ui_enhancement', 10, 6 );

/**
 * Adds a custom message to the login UI after the default UI has been rendered.
 *
 * This function checks if a password reset has been requested and displays a
 * tailored message to the user.
 *
 * @param mixed $lost_password Whether the lost password form is being displayed.
 * @param mixed $reset_password_sent Whether a password reset email has been sent.
 * @param mixed $reset_password_sent_success Whether the password reset was successful.
 * @param mixed $register Whether the registration form is being displayed.
 * @param mixed $reset_password Whether the password reset form is being displayed.
 * @param mixed $validate_password_reset Whether the password reset validation is active.
 */
function my_custom_login_ui_enhancement(
	$lost_password,
	$reset_password_sent,
	$reset_password_sent_success,
	$register,
	$reset_password,
	$validate_password_reset
) {
	// Display a success message if a password reset email was just sent.
	if ( $reset_password_sent && ! $reset_password_sent_success ) {
		echo '<p class="my-custom-login-message success">A password reset email has been sent to your inbox. Please check your spam folder if you don't see it.</p>';
	}

	// Display a confirmation message if the password reset was successful.
	if ( $reset_password_sent_success ) {
		echo '<p class="my-custom-login-message success">Your password has been successfully reset!</p>';
	}

	// Example of adding custom content when the registration form is shown.
	if ( $register ) {
		echo '<p class="my-custom-login-message info">Welcome! Please fill out the form below to create your account.</p>';
	}

	// No return statement needed as this is an action hook and doesn't modify the original output directly.
}

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/login-page-ui-default.php:162

if ( isset( $_GET['action'] ) && 'reset' === $_GET['action'] ) {
				$reset_password_sucess = $innerText['Reset-Success'];
			}
			//Nothing, default, show login form!
			include Config::get_template( apply_filters( 'uo-front-login-login-template', 'frontend-login/' . $template_to_load . '-login.php', $template_to_load ) );
		}

		do_action( 'after_uo_login_ui', $lost_password, $reset_password_sent, $reset_password_sent_success, $register, $reset_password, $validate_password_reset );
		?>
	</section>


Scroll to Top