Created
February 2, 2016 13:45
-
-
Save alessandrotesoro/be18855eddde18a43f81 to your computer and use it in GitHub Desktop.
Revisions
-
alessandrotesoro created this gist
Feb 2, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ 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 );