Adding a 2nd Email Field to Register Form to Confirm Address is Correct

I would like to know how I can add a second email field to the registration form so that when a user signs up, they enter the email in once for the system, and once more to make sure they didn't typo their email address.

This secondary email field doesn't need to be saved, it only needs to check against the first email field and if it's different, break the operation and require it be corrected.

We have confirmation emails turned off.

  • Hoang Ngo
    • Code Slayer

    Hi @Jeremy,

    I hope you are well today.
    For the extra field, please add this code to your theme functions.php or use mu-plugins

    add_action( 'signup_extra_fields', 'append_confirm_email' );
    function append_confirm_email() {
    	?>
    	<div class="email-confirm">
    		<label for="confirm_email">Confirm Email:</label>
    		<input type="email" maxlength="200" value=""
    		       id="confirm_email" name="confirm_email"><br>
    	</div>
    	<?php
    }

    I tried to find a place to hook the javascript without any modification to the plugin, however, there's no place like that :slight_frown:. So we will need to change the plugin code, please note that, you will need to re-update the code after you upgrade the plugin.

    In the file /pro-sites/pro-sites-files/js/checkout.js, line 555, you will see a code like this
    var form_fields = getFormData( $( '#prosites-user-register' ) );
    Please update it to

    var form_fields = getFormData( $( '#prosites-user-register' ) );
    if(form_fields.user_email.length > 0 && form_fields.user_email!=form_fields.confirm_email){
                alert('Email doesn\'t match');
                return;
            }

    If you have any additional issues, please let us know and we'll be happy to help.

    Best regards,
    Hoang

  • Jeremy
    • Site Builder, Child of Zeus

    @Hoang Ngo

    Thank you, our checkout.js appears to be different, we can't update because last time we updated everything broke and now we're waiting for 100% certainty on the new updates for ProSites. Our file looks like this:

    jQuery(document).ready(function($) {
    
      $('div.pblg-checkout-opt').click(function() {
    
    		var values = $('input', this).val().split(':');
    
    		$('#psts_level').val(parseInt(values[0]));
    
    		$('#psts_period').val(parseInt(values[1]));
    
    		$('div.pblg-checkout-opt').removeClass('opt-selected');
    
    		$('tr.psts_level td').removeClass('opt-selected');
    
        $(this).addClass('opt-selected');
    
        $(this).parent().addClass('opt-selected');
    
    	});
    
      jQuery('#psts-coupon-link').click(function() {
    
        $('#psts-coupon-link').hide();
    
        $('#psts-coupon-code').show();
    
        return false;
    
      });
    
    	jQuery('#psts-receipt-change a').click(function() {
    
        $('#psts-receipt-change').hide();
    
        $('#psts-receipt-input').show();
    
        return false;
    
      });
    
    });

    Any ideas?

  • Vaughan
    • Support/SLS MockingJay

    Hi Jeremy,

    Apologies for the delay. This definitely slipped off the radar.

    Can you try editing the following file:

    /wp-content/plugins/pro-sites/pro-sites-files/js/checkout.js

    Find the following on or around line 552:

    var form_fields = getFormData( $( '#prosites-user-register' ) );

    Replace it with:

    var form_fields = getFormData( $( '#prosites-user-register' ) );
            if(form_fields.user_email.length > 0 && form_fields.user_email!=form_fields.confirm_email){
                alert('Email doesn\'t match');
                return;
            }

    Thanks

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.