• Hello, I’m using s2member, customized my registration form and now I’d like to show all errors on my frontend maked registration page. Here’s my code:

    <?php $register = $_GET['register']; $reset = $_GET['reset']; if ($register == true) { ?>
            Message, when registered succesfully // it shows
            <?php } elseif ($reset == true) { ?>
            Message when lost password is ok // it shows
            <?php } else { } ?>
    
       // register form starts here
        <form method="post" action="<?php echo site_url('wp-login.php?action=register', 'login_post')?>
    
          //username
            <input type="text" aria-required="true" maxlength="100" autocomplete="off" name="user_login" id="user_login" class="user_login" value="<?php echo esc_attr(stripslashes($user_login)); ?>" tabindex="101">
          //Email
            <input type="text" aria-required="true" autocomplete="off" name="user_email" id="user_email" class="user_email" value="<?php echo esc_attr(stripslashes($user_email)); ?>" tabindex="102">
    
          //here wordpress takes the register_form customized in s2member
            <?php do_action('register_form'); ?><div id="reg-button">
            <input type="submit" name="user-submit" value="register" class="user-submit" tabindex="103" />
            <?php $register = $_GET['register']; if($register == true) { echo '<p>Check your email for the password!</p>'; } ?>
            <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" />
            <input type="hidden" name="user-cookie" value="1" />
        </form> 
    
            // now for the lost password
        <form method="post" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" class="wp-user-form">
            //You type the login/email here
                <input type="text" name="user_login" value="" size="20" id="user_login" tabindex="1001" />
    
            <?php do_action('login_form', 'resetpass'); ?>
            <input type="submit" name="user-submit" value="send pass" class="user-submit" tabindex="1002" />
            <?php $reset = $_GET['reset']; if($reset == true) { echo '<p>A message will be sent to your email address.</p>'; } ?>
            <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?reset=true" />
            <input type="hidden" name="user-cookie" value="1" />
        </form>
    
    <?php } ?>

    Basically, I’d like to show below errors on the front end, like I can show success messages now. What I’m lacking is;

    1. Username (required / already used)
    2. Email (is it valid, required, used)
    3. I have WP reCaptcha plugin, and if there is no captcha typed or it is wrong, it redirects me to the wp-login
    4. When recovering lost password, you can either type wrong username/password.

    Any ideas how I can do it?
    Thanks!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Take a look at AJAX in Plugins. AJAX is a way of checking data on the server while the user is still interacting with the form. Each check is triggered by a change or blur event of each field. If the check is OK, nothing happens, but if it fails, some sort of message is displayed.

    In the case of login forms, security experts recommend you do not get too user friendly. For example, if the username is wrong in the typical user/password input, do not say “invalid username” because then a potential hacker knows they got the password right. A generic “invalid input” is actually better. Personally, I would really hate such a message if one of the inputs was a CAPTCHA. Those inputs are simply too error prone to group with other inputs under a single invalid input message.

Viewing 1 replies (of 1 total)
  • The topic ‘Registration/lostpass errors showing on frontend’ is closed to new replies.