Create a confirm email field to match in the registration

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/ .

Post a reply

:
In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: Create a confirm email field to match in the registration

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

Post by 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,

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

Post by 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

Create a confirm email field to match in the registration

Post by 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 1838 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 1838 times


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

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

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

edit-theme-functions.gif
edit-theme-functions.gif (33.5 KiB) Viewed 1838 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 1838 times

Top

cron