Skip to content

Function

Get the username label.

tml_get_username_label( string $action = '' )

Parameters

$action string Default ''
Optional. The action.

Return

string The username label.

Source

function tml_get_username_label( $action = '' ) {

    if ( empty( $action ) ) {
        $action = tml_get_action();
    }

    // phpcs:disable WordPress.WP.I18n.MissingArgDomain -- these labels intentionally reuse WP core's translated strings verbatim, not TML-specific strings.
    switch ( $action ) {
        case 'register':
            $label = __( 'Username' );
            break;

        case 'lostpassword':
        case 'login':
        default:
            if ( tml_is_username_login_type() ) {
                $label = __( 'Username' );
            } elseif ( tml_is_email_login_type() ) {
                $label = __( 'Email' );
            } else {
                $label = __( 'Username or Email Address' );
            }
    }
    // phpcs:enable WordPress.WP.I18n.MissingArgDomain

    return apply_filters( 'tml_get_username_label', $label, $action );
}

Uses

Used by

Changelog

VersionDescription
7.0 Introduced.