Hi @connorhsm
Yes that’s correct, you can also add a secondary email field to make the user confirm the email. Here’s the code, it’s basically the same with just the name of the fields changed.
function wpum_my_email_field_confirmation( $fields ) {
$fields[ 'confirm_email' ] = array(
'label' => 'Confirm email',
'type' => 'email',
'meta' => false,
'required' => true,
'description' => 'Add something here if needed',
'priority' => 0
);
return $fields;
}
add_filter( 'wpum_get_registration_fields', 'wpum_my_email_field_confirmation' );
function wpum_verify_my_email_confirmation( $pass, $fields, $values, $form ) {
if ( $form === 'registration' && isset( $values['register']['user_email'] ) ) {
$email1 = $values['register']['user_email'];
$email2 = $values['register']['confirm_email'];
if ( $email1 !== $email2 ) {
return new WP_Error( 'psw-validation-error', 'Emails do not match.' );
}
}
return $pass;
}
add_filter( 'submit_wpum_form_validate_fields', 'wpum_verify_my_email_confirmation', 10, 4 );
I’ll add some more info the documentation soon.