Create a confirm email field to match in the registration

Here we discuss Ultimate Member ("UM") and any problems with it only. Support is provided up to version 1.0.72
Forum rules
We can provide customization or technical support at the lowest cost for your Ultimate Member WordPress site. Register at:
ucp.php?mode=register and create a new topic down below with any request you might have.

Attention: we are not the developers of this plugin. For support questions go to the Free UM support forum at:
https://wordpress.org/support/plugin/ultimate-member/ .

Create a confirm email field to match in the registration

Postby admin » Wed Sep 07, 2016 8:39 pm

Sometimes is better to have another email field in a registration form to confirm that the new user email address is correct (without errors, or typos) therefore we perform an email verification within the form itself.

Go to:

UM > Forms > Default Registration and click on edit.

edit-registration-form.gif
edit-registration-form.gif (19.07 KiB) Viewed 1839 times


Add a field and select a 'Text Box': You can fill in or change everything else in the text box except these 7 fields which need to be entered exactly this way:

  1. Title: Email Confirm
  2. Label: Email Confirm
  3. Meta Key: email_confirm (all lower case)
  4. Privacy: Everyone
  5. Visibility: View Everywhere
  6. Is this field required? Yes
  7. Can user edit this field? Yes

add-text-box.gif
add-text-box.gif (13.6 KiB) Viewed 1839 times


You are done creating your email confirmation form field in UM.

new-registration-form.gif
new-registration-form.gif (14.94 KiB) Viewed 1839 times

Next, go to Appearance > Editor > Theme Functions (steps 1 & 2).

edit-theme-functions.gif
edit-theme-functions.gif (33.5 KiB) Viewed 1839 times

Copy and paste the following code at the bottom of the theme's functions.php (step 3):

Code: Select all
// check both email fields to match in the registration form
add_action('um_submit_form_errors_hook', 'avnw_email_confirmation', 10 );
function avnw_email_confirmation( $args ){
global $ultimatemember;
if( $args['user_email'] != $args['email_confirm'] ) {
 $ultimatemember->form->add_error( 'user_email', 'your email does not match');
}
}



You should now have a confirmation email field set up in your registration form, so if someone types an address different from the email address field, the registration form will not be submitted and an error message: "your email does not match" will appear.

email-confirmation-field.gif
email-confirmation-field.gif (7.66 KiB) Viewed 1839 times
The AVNW Support Team
http://www.AVeryNiceWeb.com

If there is a false accusation made against you, then remove this fake report.

Shopping for a new website? See our design deals.

How much is your website worth? Get a free estimate.

And, if our post has provided you with great information, there are a few ways you can show your appreciation:
  1. Like us on Facebook
  2. Post a review.- Posting a good review about this site could help us provide improved support.

Thank You!
User avatar
admin
Site Admin
 
Posts: 561
Joined: Sun Jan 12, 2014 11:18 pm
Location: New York City

Re: Create a confirm email field to match in the registratio

Postby PeteB » Sat Oct 03, 2020 3:44 pm

Hi - I'd love to be able to use this code to enable an email confirmation field in a UM registration form - but if I add the code I just get a blank page when I submit the registration form. Is there an update for it possibly - I realise it's 4yrs old now . . .

Many thanks
Pete
PeteB
 

Re: Create a confirm email field to match in the registratio

Postby admin » Sat Oct 31, 2020 10:57 am

PeteB wrote:Hi - I'd love to be able to use this code to enable an email confirmation field in a UM registration form - but if I add the code I just get a blank page when I submit the registration form. Is there an update for it possibly - I realise it's 4yrs old now . . .

Many thanks
Pete


Hard to say why but yes, this worked on UM 4 years ago. Regardless, make sure you check your functions.php in your WordPress theme's folder and that is actually coded the way it was instructed above. Otherwise, you may have placed the code the wrong way or in the wrong place.

Hope this helps,
The AVNW Support Team
http://www.AVeryNiceWeb.com

If there is a false accusation made against you, then remove this fake report.

Shopping for a new website? See our design deals.

How much is your website worth? Get a free estimate.

And, if our post has provided you with great information, there are a few ways you can show your appreciation:
  1. Like us on Facebook
  2. Post a review.- Posting a good review about this site could help us provide improved support.

Thank You!
User avatar
admin
Site Admin
 
Posts: 561
Joined: Sun Jan 12, 2014 11:18 pm
Location: New York City


Return to Ultimate Member

Who is online

Users browsing this forum: No registered users and 1 guest

cron