Action uncanny-learndash-toolkit

uo_login_before_description

Fires before the login form description is displayed on the login page.

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

Description

Fires before the login description is displayed. Developers can use this hook to add content or modify behavior preceding the login description output. It's a good point for pre-description customizations.


Usage

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

Examples

<?php
/**
 * Example usage of the 'uo_login_before_description' action hook.
 * This function adds a custom message before the login description.
 *
 * @param object $login The login object, containing configuration and strings.
 */
add_action( 'uo_login_before_description', function( $login ) {
    // Check if the custom message feature is enabled in the plugin's settings.
    // This is a hypothetical setting. In a real plugin, this would come from
    // get_option() or a plugin-specific configuration object.
    $custom_message_enabled = true; // Replace with actual logic

    if ( $custom_message_enabled && isset( $login->strings->custom_pre_description_message ) && ! empty( $login->strings->custom_pre_description_message ) ) {
        ?>
        <div class="custom-login-message">
            <p><?php echo esc_html( $login->strings->custom_pre_description_message ); ?></p>
        </div>
        <?php
    }
}, 10, 1 ); // Priority 10, accepts 1 argument.

/*
 * Assuming the $login object passed to the hook has a property like:
 *
 * $login->strings->custom_pre_description_message = 'Welcome back! Please log in to continue.';
 *
 * The output would be:
 *
 * <div class="custom-login-message">
 *     <p>Welcome back! Please log in to continue.</p>
 * </div>
 *
 * This is a simple example demonstrating how to hook into 'uo_login_before_description'
 * and add custom content before the login form's description.
 */

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/layout_1-login.php:177
src/templates/frontend-login/modern_ui-login.php:184

<div class="ult-form__title">
					<?php echo $login->strings->title; ?>
				</div>

			<?php } ?>

			<?php do_action( 'uo_login_before_description' ); ?>

			<?php if ( $login->config->show_description ){ ?>

				<div class="ult-form__description">
					<?php echo $login->strings->description; ?>
				</div>


Scroll to Top