• Resolved dimendia

    (@dimendia)


    So I created a theme-my-login-custom.php as described in the link https://docs.thememylogin.com/adding-extra-registration-fields/.

    Likewise, I have entered the required data in the register_form.php.

    First name and last name are saved, but he does not accept my checkbox and the error message always comes up even though the checkbox is activated:

    excerpt from the theme-my-login-custom.php

    function tml_registration_errors( $errors ) {
        if ( empty( $_POST['first_name'] ) )
            $errors->add( 'empty_first_name', '<strong>FEHLER</strong>: Bitte gib deinen Vornamen ein.' );
        if ( empty( $_POST['last_name'] ) )
            $errors->add( 'empty_last_name', '<strong>FEHLER</strong>: Bitte gib deinen Nachname ein.' );
        if ( empty( $_POST['DSGVO'] == "OK") )
            $errors->add ( 'empty_DSGVO', '<strong>FEHLER</strong>: Bitte der Speicherung zustimmen.' );
        return $errors;
    }

    excerpt from register_form.php

    <p>
                Dieses Formular speichert Deinen Namen, Deine Email Adresse sowie den Inhalt, damit wir Deine Registrierung bearbeiten k?nnen. Weitere Informationen findest Du auf unserer Seite der <a href="https://domain.de/datenschutz/">Datenschutzbestimmungen</a>.<br />
            <input type="checkbox" name="DSGVO" id="user_dsgvo<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_dsgvo' ); ?>" /> mit der Speicherung einverstanden</p>

    Where is the mistake ?
    MEGA THANK YOU in advance … I am desperate here

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

    (@jfarthing84)

    Change the code in theme-my-login-custom.php to this:

    
    function tml_registration_errors( $errors ) {
        if ( empty( $_POST['first_name'] ) )
            $errors->add( 'empty_first_name', '<strong>FEHLER</strong>: Bitte gib deinen Vornamen ein.' );
        if ( empty( $_POST['last_name'] ) )
            $errors->add( 'empty_last_name', '<strong>FEHLER</strong>: Bitte gib deinen Nachname ein.' );
        if ( empty( $_POST['DSGVO'] ) )
            $errors->add ( 'empty_DSGVO', '<strong>FEHLER</strong>: Bitte der Speicherung zustimmen.' );
        return $errors;
    }
    

    Change the code for the checkbox in register_form.php to this:

    
    <input type="checkbox" name="DSGVO" id="user_dsgvo<?php $template->the_instance(); ?>" class="input" value="1" <?php checked( ! empty( $_POST['DSGVO'] ) ); ?> />
    
    Thread Starter dimendia

    (@dimendia)

    tanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘checkbox on register_form’ is closed to new replies.