Skip to content

Function

Register the lost password form.

tml_register_lost_password_form( )

Source

function tml_register_lost_password_form() {
    // phpcs:disable WordPress.WP.I18n.MissingArgDomain -- these field labels intentionally reuse WP core's translated wp-login.php strings verbatim, not TML-specific strings.

    tml_register_form(
        'lostpassword',
        array(
            'action'     => tml_get_action_url( 'lostpassword' ),
            'attributes' => array_filter(
                array(
                    'data-ajax' => tml_use_ajax() ? 1 : 0,
                )
            ),
        )
    );

    tml_add_form_field(
        'lostpassword',
        'message',
        array(
            'type'     => 'custom',
            'content'  => '<p class="tml-message">' . __( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ) . '</p>',
            'priority' => 10,
        )
    );

    tml_add_form_field(
        'lostpassword',
        'user_login',
        array(
            'type'       => 'text',
            'label'      => tml_get_username_label( 'lostpassword' ),
            'value'      => tml_get_request_value( 'user_login', 'post' ),
            'id'         => 'user_login',
            'attributes' => array(
                'autocapitalize' => 'off',
            ),
            'priority'   => 10,
        )
    );

    tml_add_form_field(
        'lostpassword',
        'lostpassword_form',
        array(
            'type'     => 'action',
            'priority' => 15,
        )
    );

    tml_add_form_field(
        'lostpassword',
        'submit',
        array(
            'type'     => 'submit',
            'value'    => __( 'Get New Password' ),
            'priority' => 20,
        )
    );

    tml_add_form_field(
        'lostpassword',
        'redirect_to',
        array(
            'type'     => 'hidden',
            'value'    => apply_filters( 'lostpassword_redirect', tml_get_request_value( 'redirect_to' ) ),
            'priority' => 20,
        )
    );
    // phpcs:enable WordPress.WP.I18n.MissingArgDomain
}

Uses

Used by

Changelog

VersionDescription
7.0 Introduced.