Action uncanny-learndash-toolkit

before_uo_login_ui

Fires before the User Login UI is displayed, allowing modifications to its elements and behavior.

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

Description

Fires before the default User Login UI is rendered. Developers can use this action to conditionally modify the login form's appearance or behavior based on the provided boolean parameters indicating different login states.


Usage

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

Examples

/**
 * Example function to hook into before_uo_login_ui.
 * This example checks if registration is allowed and adds a custom message.
 *
 * @param bool $lost_password Whether the lost password form is being displayed.
 * @param bool $reset_password_sent Whether a password reset email has been sent.
 * @param bool $reset_password_sent_success Whether the password reset was successful.
 * @param bool $register Whether the registration form is being displayed.
 * @param bool $reset_password Whether the password reset form is being displayed.
 * @param bool $validate_password_reset Whether password reset validation is occurring.
 */
function my_custom_login_ui_message( $lost_password, $reset_password_sent, $reset_password_sent_success, $register, $reset_password, $validate_password_reset ) {
	// Check if registration is currently enabled in WordPress settings.
	if ( get_option( 'users_can_register' ) && $register ) {
		echo '<div class="my-custom-login-notice" style="background-color: #e7f3fe; border-left: 6px solid #2196F3; padding: 10px; margin-bottom: 15px;">';
		echo '<p><strong>Welcome!</strong> New users can register on this site. If you have an account, please <a href="' . esc_url( wp_login_url() ) . '">login</a>.</p>';
		echo '</div>';
	}

	// You could also add custom messages based on other parameters, for example:
	// if ( $lost_password ) {
	//     // Add a hint for the lost password process.
	// }
}
add_action( 'before_uo_login_ui', 'my_custom_login_ui_message', 10, 6 );

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:22

* @arg bool $lost_password
		 * @arg bool $reset_password_sent
		 * @arg bool $reset_password_sent_success
		 * @arg bool $register
		 * @arg bool $reset_password
		 * @arg bool $validate_password_reset
		 */
		do_action( 'before_uo_login_ui', $lost_password, $reset_password_sent, $reset_password_sent_success, $register, $reset_password, $validate_password_reset );

		if ( is_user_logged_in() ) {
			//If User is Logged In, we don't need to show any form!

			?>

			<div class="uo-default-message-block">


Scroll to Top