• Resolved woorooo

    (@woorooo)


    Hi,

    I would like to change the placeholder text of username on login forms saying:
    “Username or email” instead of just “Email”.

    However when I do that via form builder the text also is changed on the registration form, which is not what I want. Is there a way to change it only on login form?

    Thank you,

    Roman.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Guust

    (@goldroo)

    Hi Roman, the placeholder can be edited with the language files in the same way as explained here: https://docs.wpgeodirectory.com/article/97-how-to-translate-or-localize-geodirectory

    By default the Login form does not say “Email” but “Username”.

    Thanks

    Thread Starter woorooo

    (@woorooo)

    By default the Login form does not say “Email” but “Username”

    Yeah, my mistake, I meant “username”.

    Thank you ??

    Thread Starter woorooo

    (@woorooo)

    Just edited the language file, but unfortunately it changes placeholder text for both registration form and login form. And the problem is that on registration form having it as “Username or email” doesn’t make sense.

    Is there any way to change it only for login form?

    • This reply was modified 4 years ago by woorooo.

    Hi,

    Please try following code in functions.php file of your currently active theme or using Code Snippet plugin and let me know if it works for you or not:

    add_filter('uwp_get_field_placeholder', 'uwp_get_field_placeholder_cb', 10, 2);
    function uwp_get_field_placeholder_cb($placeholder, $field){
        if(isset($field) && isset( $field->form_type ) && $field->form_type == 'login' && $field->htmlvar_name == 'username' ){
            $placeholder = __( "Username or Email", 'userswp' );
            if ( isset( $field->is_required ) && ! empty( $field->is_required ) ) {
    		    $placeholder .= ' *';
    	    }
        }
    
        return $placeholder;
    }

    Please change “Username or Email” to whatever text you want.

    Regards,
    Patrik

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Login form Placeholder for Username’ is closed to new replies.