Support » Plugin: Theme My Login » Hint text, under the username field

  • Resolved robertherold

    (@robertherold)


    Hi,

    I would like to ask how can I place text below the username field? For example, can only Latin alphabet letters and numbers be used?

    Thank you! πŸ™‚

    • This topic was modified 1 month, 2 weeks ago by robertherold.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    Try this:

    
    add_action( 'init', function() {
        if ( $log = tml_get_form_field( 'login', 'log' ) ) {
            $log->description = 'YOUR TEXT HERE';
        }
    } );
    

    Sorry, it prints an error:

    There has been a critical error on your website.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Where did you place the code?

    functions.php

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Perhaps you’re somehow not using the recommended minimum PHP version for WP? Try this instead:

    
    function add_hints_to_login_form() {
        if ( $log = tml_get_form_field( 'login', 'log' ) ) {
            $log->description = 'YOUR TEXT HERE';
        }
    }
    add_action( 'init', 'add_hints_to_login_form' );
    

    Thanks for the reply.
    Unfortunately, the code is still incorrect. It won’t accept it this time.

    https://i.imgur.com/gu2mw2m.png

    Running PHP version: 7.4.8
    Theme My Login Version 7.0.15

    And I don’t want text on the login form, but on the registration page to see what characters are allowed in the username. πŸ™‚

    • This reply was modified 1 month, 1 week ago by robertherold.
    Plugin Author Jeff Farthing

    (@jfarthing84)

    Sorry – one more try:

    
    function add_hints_to_login_form() {
        if ( $log = tml_get_form_field( 'login', 'log' ) ) {
            $log->set_description( 'YOUR TEXT HERE' );
        }
    }
    add_action( 'init', 'add_hints_to_login_form' );
    
    robertherold

    (@robertherold)

    Thank you very much! It seems to work!
    But I want to put it on the Register (Sign Up) page! πŸ™‚

    robertherold

    (@robertherold)

    I found it. I hope πŸ™‚

    function add_hints_to_register_form() {
        if ( $reg = tml_get_form_field( 'register', 'user_login' ) ) {
            $reg->set_description( 'Please use only the letters of the Latin aplhabet and numbers in your username.' );
        }
    }
    add_action( 'init', 'add_hints_to_register_form' );
Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.