Skip to content

Instantly share code, notes, and snippets.

@alessandrotesoro
Created February 2, 2016 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alessandrotesoro/be18855eddde18a43f81 to your computer and use it in GitHub Desktop.
Save alessandrotesoro/be18855eddde18a43f81 to your computer and use it in GitHub Desktop.
WPUM add email confirmation at registration
function wpum_add_new_email_field( $fields ) {
$fields[ 'confirm_email' ] = array(
'label' => 'Confirm Email',
'type' => 'email',
'meta' => 'email_confirmation',
'required' => true,
'description' => 'Add something here if needed',
);
return $fields;
}
add_filter( 'wpum_get_registration_fields', 'wpum_add_new_email_field' );
function wpum_verify_email_confirmation( $passed, $fields, $values ) {
$first_email = $values['register'][ 'user_email' ];
$confirm_email = $values['register'][ 'confirm_email' ];
if( $first_email !== $confirm_email ) {
return new WP_Error( 'email-validation-error', 'Email mismatch' );
}
return $passed;
}
add_filter( 'wpum/form/validate=register', 'wpum_verify_email_confirmation', 10, 3 );
@AreWeThereYet
Copy link

Is there anyway to control the displaying of the fields? In the theme I am using it shows email, password then confirmation email. I would like the two email boxes under each other.

And obviously, this git entry worked like a champ so thanks!

Geoff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment