create a whitelist for emails at regestration
-
Hello,
I am trying to make it so that only people from a certain email provider can register through UM. The code that I currently put in my functions.php is:
function my_submit_form_errors_registration( $args ) { // Change allowed email domains here $allowed_email_domains = apply_filters( 'um_allowed_email_domains', array( 'yahoo.com' ) ); // Change error message here $message = __( 'You can not use this email domain for registration', 'ultimate-member' ); if ( isset( $args['username'] ) && is_email( $args['username'] ) ) { $email_domain = array_pop( explode( '@', trim( $args['username'] ) ) ); if ( !in_array( $email_domain, $allowed_email_domains ) ) { UM()->form()->add_error( 'username', $message ); } } } add_action( 'um_submit_form_errors_hook__registration', 'my_submit_form_errors_registration', 10, 1 );
For some reason this code appears to do nothing because when trying to register with an email from for example gmail.com it still allows me to do so.
I am looking forward to a response.
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘create a whitelist for emails at regestration’ is closed to new replies.