Support » Plugin: Theme My Login » What about Login & Register on the same page ?

  • Resolved reskatorfr

    (@reskatorfr)


    Argh ! with v7, how to have the both forms (login & register) on the same page ?

    I added the fields first_name and last_name, but they appear in both forms … since the register page also includes the login form (and conversely: the login page also contains the register form… without first_name & last_name fields)

    The page I need help with: [log in to see the link]

Viewing 15 replies - 16 through 30 (of 41 total)
  • I tried with :

    function customize_tml_registrarion_form() {
        if ( $form = tml_get_form( 'register' ) ) {
            $form->render_args['before'] = 	do_action( 'woocommerce_before_customer_login_form' );
            $form->render_args['after'] = do_action( 'woocommerce_after_customer_login_form' );
        }
    }

    and with :

    function customize_tml_registrarion_form() {
        if ( $form = tml_get_form( 'register' ) ) {
            $form->render_args['before'] = 'trying something';
            $form->render_args['after'] = 'trying something else';
        }
    }

    but none works.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Try this:

    
    function customize_tml_registrarion_form() {
        if ( $form = tml_get_form( 'register' ) ) {
            $form->render_args['before'] = 'trying something';
            $form->render_args['after'] = 'trying something else';
        }
        print_r($form);
    }
    

    And post the output.

    I did not understand, the print_r () produced nothing … and then I corrected the name of the function (registrarion => registration):

    Theme_My_Login_Form Object
    (
        [name:protected] => register
        [action:protected] => https://new.cutecase.fr/login/
        [method:protected] => post
        [fields:protected] => Array
            (
                [user_login] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => user_login
                        [type:protected] => text
                        [value:protected] => 
                        [label:protected] => Identifiant
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => 
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                                [id] => user_login
                                [class] => tml-field
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 10
                        [render_args] => Array
                            (
                            )
    
                    )
    
                [user_email] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => user_email
                        [type:protected] => email
                        [value:protected] => 
                        [label:protected] => Adresse de messagerie
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => 
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                                [id] => user_email
                                [class] => tml-field
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 15
                        [render_args] => Array
                            (
                            )
    
                    )
    
                [reg_passmail] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => reg_passmail
                        [type:protected] => custom
                        [value:protected] => 
                        [label:protected] => 
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => <p id="reg_passmail">La confirmation d’inscription vous sera envoyée par e-mail.</p>
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                                [class] => tml-field
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 25
                        [render_args] => Array
                            (
                            )
    
                    )
    
                [submit] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => submit
                        [type:protected] => submit
                        [value:protected] => Inscription
                        [label:protected] => 
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => 
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                                [class] => tml-button
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 30
                        [render_args] => Array
                            (
                            )
    
                    )
    
                [redirect_to] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => redirect_to
                        [type:protected] => hidden
                        [value:protected] => https://new.cutecase.fr/login/?pending=activation
                        [label:protected] => 
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => 
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 30
                        [render_args] => Array
                            (
                            )
    
                    )
    
                [first_name] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => first_name
                        [type:protected] => text
                        [value:protected] => 
                        [label:protected] => Prénom
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => 
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                                [id] => first_name
                                [class] => tml-field
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 15
                        [render_args] => Array
                            (
                            )
    
                    )
    
                [last_name] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => last_name
                        [type:protected] => text
                        [value:protected] => 
                        [label:protected] => Nom
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => 
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                                [id] => last_name
                                [class] => tml-field
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 15
                        [render_args] => Array
                            (
                            )
    
                    )
    
                [user_consentsprivacy-policy] => Theme_My_Login_Form_Field Object
                    (
                        [name:protected] => user_consentsprivacy-policy
                        [type:protected] => checkbox
                        [value:protected] => 
                        [label:protected] => Vous avez lu et vous acceptez notre <a href="/politique-de-confidentialite/" target="_blank" data-slimstat="5">Politique de Confidentialité</a>.
                        [description:protected] => 
                        [error:protected] => 
                        [content:protected] => 
                        [options:protected] => Array
                            (
                            )
    
                        [attributes:protected] => Array
                            (
                                [id] => privacy-policy-consent
                                [class] => tml-checkbox
                            )
    
                        [form:protected] => Theme_My_Login_Form Object
     *RECURSION*
                        [priority:protected] => 15
                        [render_args] => Array
                            (
                            )
    
                    )
    
            )
    
        [priorities:protected] => Array
            (
                [10] => Array
                    (
                        [0] => user_login
                    )
    
                [15] => Array
                    (
                        [0] => user_email
                        [1] => first_name
                        [2] => last_name
                        [3] => user_consentsprivacy-policy
                    )
    
                [25] => Array
                    (
                        [0] => reg_passmail
                    )
    
                [30] => Array
                    (
                        [0] => submit
                        [1] => redirect_to
                    )
    
            )
    
        [attributes:protected] => Array
            (
            )
    
        [errors:protected] => WP_Error Object
            (
                [errors] => Array
                    (
                    )
    
                [error_data] => Array
                    (
                    )
    
            )
    
        [links:protected] => Array
            (
            )
    
        [render_args] => Array
            (
                [before] => trying something
                [after] => trying something else
            )
    
    )
    Plugin Author Jeff Farthing

    (@jfarthing84)

    That’s why it’s not working! I typo’d the function name. Fix that and you should be golden!

    the function works (with or without tml_buffer_action_hook) but the page is refreshed immediately: the notice appears, then the page is redrawn.

    The best is to see it: https://new.cutecase.fr/login/

    Plugin Author Jeff Farthing

    (@jfarthing84)

    What does it do with the arbitrary text?

    With the arbitrary text, it’s ok : “trying something” is before the form
    and “trying something else” is after the form

    => https://new.cutecase.fr/login/

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Was this setup working before?

    If the “before” means v6.4, yes => https://www.cutecase.fr/login/

    ( Everything in its time, but there are still other problems when both forms are on the same page :-/ )

    Plugin Author Jeff Farthing

    (@jfarthing84)

    If your final code is utilizing do_action, that’s incorrect. You must use the tml_buffer_action_hook function.

    
    function customize_tml_registration_form() {
        if ( $form = tml_get_form( 'register' ) ) {
            $form->render_args['before'] = 	tml_buffer_action_hook( 'woocommerce_before_customer_login_form' );
            $form->render_args['after'] = tml_buffer_action_hook( 'woocommerce_after_customer_login_form' );
        }
    }
    add_action( 'init', 'customize_tml_registration_form' );
    

    Wonderful. Thank you.

    Now another problem :

    Voluntarily, I do not fill any field and I validate the login form:
    Errors appear and concern in the registration form.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Just to verify, “login” is set as the slug for Log In in the TML slug settings?

    Yes, it is set to “login” for Log In

    (AND, it is set also to “login” for Register since they are on the same page. it’s correct ?)

    Plugin Author Jeff Farthing

    (@jfarthing84)

    No. That’s why it’s doing that.

Viewing 15 replies - 16 through 30 (of 41 total)
  • The topic ‘What about Login & Register on the same page ?’ is closed to new replies.