Action uncanny-learndash-toolkit

uo_login_after_container

Fires after the login form container is output on the frontend.

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

Description

Fires after the main login form container is rendered. Developers can use this action to inject additional content, scripts, or perform actions immediately after the login form's HTML structure. This hook is ideal for post-render modifications or custom integrations related to the login interface.


Usage

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

Examples

<?php
/**
 * Add custom JavaScript to enhance the login form's usability.
 * This example ensures the email and password fields are marked as required
 * using JavaScript, providing immediate feedback to the user if they are empty.
 */
function my_custom_login_script() {
    // Check if we are on a relevant page or context if necessary,
    // though this hook is usually called within a specific plugin's template.
    // For demonstration, we'll assume it's always appropriate.

    ?>
    <script type='text/javascript'>
        jQuery(document).ready(function ($) {
            // Ensure email and password fields are marked as required using JavaScript.
            // This provides client-side validation before form submission.
            $('#ult-login-email').attr('required', 'required');
            $('#ult-login-password').attr('required', 'required');

            // You could add more complex JavaScript logic here if needed,
            // such as custom validation, dynamic field manipulation, or integrations.
            // For instance, to add a placeholder dynamically:
            // $('#ult-login-email').attr('placeholder', 'Your Email Address');
        });
    </script>
    <?php
}
// Hook the function to the 'uo_login_after_container' action.
// The '10' is the default priority, and '0' signifies that the function
// does not accept any arguments passed by the do_action call.
add_action( 'uo_login_after_container', 'my_custom_login_script', 10, 0 );

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:243
src/templates/frontend-login/modern_ui-login.php:250

<script type='text/javascript'>
	jQuery(document).ready(function () {
		jQuery('#ult-login-email').attr('required', 'required')
		jQuery('#ult-login-password').attr('required', 'required')
	})
</script>

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


Scroll to Top