• Hi guys,

    I want to add a checkbox “Accept disclaimer” to default WordPress Login Form.
    Look at this :

    // Fields for redirect
    function custom_login_fields() {
    ?>
    	<p><label for="disclaimer"><input name="disclaimer" type="checkbox" id="disclaimer" tabindex="50"<?php checked( $disclaimer ); ?> /> J'accepte le <a href="<?php bloginfo('url'); ?>/disclaimer" target="_blank" title="Lien vers le disclaimer">disclaimer</label></p><br /><br />
    
    <?php
    }
    
    // Add fields to the login form
    add_action('login_form','custom_login_fields');
    
    function check_field_disclaimer($errors) {
    // validation function
    global $disclaimer;
    if (!isset($_POST['disclaimer'])) {
    $errors->add('empty_realname', "<strong>Error:</strong> Vous devez accepter le disclaimer.");
    }
    }

    But now I want to show the error when we submit it. If checkbox is not checked, i show error…

    I know, it is just a piece of code but I cannot find it with Google. For register form we use :
    add_action('register_post', check function here)

    But for login form ?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Did you figure this out? I need the same thing, thanks!

    Moderator bcworkz

    (@bcworkz)

    Not 100% sure, but it looks like you can hook the ‘authenticate’ filter. Return the passed user object on success, or return a new WP_Error object on failure.

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