Filter uncanny-learndash-toolkit

uo-login-inner-text

Filters the inner text displayed within the login form, allowing customization before it renders.

add_filter( 'uo-login-inner-text', $callback, 10, 1 );

Description

Filters the text content displayed within the login modal, specifically between the login form and the forgot password section. Developers can use this hook to add custom content, links, or modify the existing 'not-set' placeholder before it's rendered.


Usage

add_filter( 'uo-login-inner-text', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

<?php
/**
 * Example of modifying the inner text of the login modal, specifically for the forgotten password section.
 * This filter allows developers to change the default text or inject custom HTML.
 *
 * @param mixed $inner_text The original inner text content.
 * @param mixed $default_value The default value passed to the filter.
 * @return mixed The modified inner text.
 */
add_filter( 'uo-login-inner-text', function( $inner_text, $default_value ) {
    // In this example, we'll append a message to the default inner text.
    // We check if the $default_value is indeed 'not-set' as per the source,
    // to ensure we are modifying the intended content.
    if ( 'not-set' === $default_value ) {
        // Let's assume $inner_text is HTML or a string.
        // We can append some custom text or HTML.
        $custom_message = '<p class="custom-login-info">If you're having trouble, please <a href="/contact-us/">contact support</a>.</p>';
        $inner_text .= $custom_message;
    }

    // It's crucial to return the filtered value.
    return $inner_text;
}, 10, 2 ); // Priority 10, accepts 2 arguments
?>

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/login-modal.php:21
src/classes/frontend-login-plus.php:1939

<div id="ult-login-modal__login">
            <?php echo do_shortcode( '[uo_login_ui]' ); ?>
        </div>
        <div id="ult-login-modal__forgot-password">
            <?php
            $recaptcha_key         = Config::get_settings_value( 'uo_frontend_login_recaptcha_key', 'FrontendLoginPlus' );
            $recaptcha_secrete_key = Config::get_settings_value( 'uo_frontend_login_recaptcha_secret_key', 'FrontendLoginPlus' );
            $innerText        = apply_filters( 'uo-login-inner-text', FrontendLoginPlus::fetch_inner_text(), 'not-set' );
            
            include( Config::get_template( apply_filters( 'uo-front-login-lost-pwd-template', 'frontend-login/layout_1-lost-pwd.php', 'layout_1' ) ) );

            ?>
        </div>
    </div>
</div>


Scroll to Top