Created
December 7, 2020 16:15
-
-
Save yousufansa/10fb62269044cf1df5b341d5d3acdbcb to your computer and use it in GitHub Desktop.
Jobhunt - Add the Email confirm field on Jobhunt Registration Form
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 characters
| if ( ! function_exists( 'jh_child_registration_form_confirm_email_field' ) ) { | |
| function jh_child_registration_form_confirm_email_field() { | |
| ?> | |
| <p class="jobhunt-confirm-email"> | |
| <label for="jobhunt_register_confirm_user_email"><?php esc_html_e( 'Conform Email', 'jobhunt' ); ?> | |
| <input name="jobhunt_user_confirm_email" id="jobhunt_register_confirm_user_email" required class="required" type="email"/> | |
| </label> | |
| </p> | |
| <?php | |
| } | |
| } | |
| add_action( 'jobhunt_registration_form_fields_after', 'jh_child_registration_form_confirm_email_field' ); | |
| if ( ! function_exists( 'jh_child_registration_form_confirm_email_field_validation' ) ) { | |
| function jh_child_registration_form_confirm_email_field_validation() { | |
| if ( isset( $_POST['jobhunt_user_confirm_email'] ) ) { | |
| $user_email = sanitize_email( $_POST["jobhunt_user_email"] ); | |
| $confirm_email = sanitize_email( $_POST["jobhunt_user_confirm_email"] ); | |
| if( $user_email !== $confirm_email ) { | |
| jobhunt_form_errors()->add('email_invalid', esc_html__('Email does not match','jobhunt')); | |
| } | |
| } | |
| } | |
| } | |
| add_action( 'jobhunt_register_form_custom_field_validation', 'jh_child_registration_form_confirm_email_field_validation' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment