Enable Registration Email Validation for Company Emails
-
This snippet works to show an error when an email CONTAINS “gmail.com”
How can I set it up so that it does the opposite – I want only “@company.com” emails to be able to register.
So instead of denying a “gmail.com” email address, I want it to only accept a “company.com” email
Snippet:
add_action(‘um_submit_form_errors_hook_’,’um_custom_validate_email’, 999, 1);
function um_custom_validate_email( $args ) {if ( isset( $args[‘user_email’] ) && strstr( $args[‘user_email’], ‘gmail.com’ ) ) {
UM()->form()->add_error( ‘user_email’, ‘You must use your company provided email address’ );
}
}
- The topic ‘Enable Registration Email Validation for Company Emails’ is closed to new replies.