Skip to content

Function

Register the activation form.

tml_ms_register_activation_form( )

Source

function tml_ms_register_activation_form() {

    tml_register_form(
        'activate',
        array(
            'action'      => tml_get_action_url( 'activate' ),
            'attributes'  => array(
                'id'         => 'activateform',
                'novalidate' => 'novalidate',
            ),
            'render_args' => array(
                'show_links' => false,
            ),
        )
    );

    $key = tml_get_request_value( 'key' );

    // phpcs:disable WordPress.WP.I18n.MissingArgDomain -- these labels intentionally reuse WP core's translated wp-activate.php/wp-login.php/user-new.php strings verbatim, not TML-specific strings.
    tml_add_form_field(
        'activate',
        'key',
        array(
            'type'     => tml_allow_user_passwords() && $key ? 'hidden' : 'text',
            'label'    => tml_allow_user_passwords() && $key ? '' : __( 'Activation Key:' ),
            'value'    => $key,
            'id'       => 'key',
            'priority' => 5,
        )
    );

    if ( tml_allow_user_passwords() && $key ) {
        tml_add_form_field(
            'activate',
            'user_pass1',
            array(
                'type'       => 'password',
                'label'      => __( 'Password' ),
                'id'         => 'pass1',
                'attributes' => array(
                    'autocomplete' => 'off',
                ),
                'priority'   => 10,
            )
        );

        tml_add_form_field(
            'activate',
            'user_pass2',
            array(
                'type'       => 'password',
                'label'      => __( 'Confirm Password' ),
                'id'         => 'pass2',
                'attributes' => array(
                    'autocomplete' => 'off',
                ),
                'priority'   => 10,
            )
        );

        tml_add_form_field(
            'activate',
            'indicator',
            array(
                'type'     => 'custom',
                'content'  => '<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite">' . __( 'Strength indicator' ) . '</div>',
                'priority' => 10,
            )
        );

        tml_add_form_field(
            'activate',
            'indicator_hint',
            array(
                'type'     => 'custom',
                'content'  => '<p class="description indicator-hint">' . wp_get_password_hint() . '</p>',
                'priority' => 10,
            )
        );
    }

    tml_add_form_field(
        'activate',
        'submit',
        array(
            'type'     => 'submit',
            'value'    => __( 'Activate' ),
            'priority' => 15,
        )
    );
    // phpcs:enable WordPress.WP.I18n.MissingArgDomain
}

Uses

Used by

Changelog

VersionDescription
7.0 Introduced.