731eccd9 by Jeff Balicki

email domain

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 4c19c8b0
...@@ -167,4 +167,23 @@ function is_valid_email_domain($login, $email, $errors ){ ...@@ -167,4 +167,23 @@ function is_valid_email_domain($login, $email, $errors ){
167 } 167 }
168 } 168 }
169 add_action('register_post', 'is_valid_email_domain',10,3 ); 169 add_action('register_post', 'is_valid_email_domain',10,3 );
170
...\ No newline at end of file ...\ No newline at end of file
170
171
172
173
174 add_action( 'um_submit_form_errors_hook__registration', 'um_register_email_provider_restrict', 99 );
175
176 function um_register_email_provider_restrict( $args ) {
177 // List the email providers you want to allow
178 $allowed_domains = array("gotenzing.com","ekccu.com","stellervista.com");
179
180 // For each domain provider check if the domain provider is allowed for registration.
181 foreach( $allowed_domains as $domain ) {
182 if ( isset( $args['user_email'] ) ) {
183 if ( !strstr( $args['user_email'], $domain ) ) {
184 $message = sprintf( __( 'Only use the email domain %1$s, %2$s for registration', 'ultimate-member' ), $allowed_domains[0], $allowed_domains[1] );
185 UM()->form()->add_error( 'user_email', $message );
186 }
187 }
188 }
189 }
...\ No newline at end of file ...\ No newline at end of file
......