• Resolved benjaminniess

    (@benjaminniess)


    Hi,

    Would it be possible to add an extra filter maybe on the Theme_My_Login_Form_Field class constructor after the wp_parse_args function so we could customize the value property for example?

    Something like that:

    $args = apply_filters( 'tml_login_form_field_args', wp_parse_args( $args, array(
        'type'        => 'text',
        'value'       => '',
        'label'       => '',
        'description' => '',
        'error'       => '',
        'content'     => '',
        'options'     => array(),
        'attributes'  => array(),
    ) ) );

    File : theme-my-login/includes/class-theme-my-login-form-field.php L129.

    Thank you.
    Best,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    Perhaps this new action would work?

    Thread Starter benjaminniess

    (@benjaminniess)

    Hi Jeff,

    Thanks for your reply. I don’t see this new action in the latest version of the plugin and I don’t get how I could change the field label with and action before the render process.

    I think the filter I suggested would do the job.

    Let me know if I can help you.
    Best,
    Ben

    Plugin Author Jeff Farthing

    (@jfarthing84)

    You don’t see it because it hasn’t been released yet. You could use it like so:

    
    function before_tml_render_form_field( $form_name, $field_name, $field ) {
        if ( 'user_login' == $field_name ) {
            $field->set_label( 'Choose a Username' );
        }
    }
    add_action( 'tml_render_form_field', 'before_tml_render_form_field', 10, 3 );
    

    However, if you just want to change labels and the like, you can just use the init action:

    
    function modify_tml_form_fields() {
        if ( $user_login = tml_get_form_field( 'register', 'user_login' ) ) {
            $user_login->set_label( 'Choose a Username' );
        }
    }
    add_action( 'init', 'modify_tml_form_fields' );
    
    Thread Starter benjaminniess

    (@benjaminniess)

    Hi Jeff,

    Thank you, the set_label method is exactly what I was looking for.

    Best

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filter request for form submit button label’ is closed to new replies.