Add checkbox to Login Form (3 posts)

  1. vbaguet
    Posted 3 years ago #

    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 />
    // Add fields to the login form
    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 ?


  2. phatpat10
    Posted 2 years ago #

    Did you figure this out? I need the same thing, thanks!

  3. bcworkz
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic