Hi @wladino
Yes that’s possible through filters, you’ll need to add your own custom validation rules.
Here’s a quick example, you can copy and paste this code into your theme’s functions.php file.
function wpum_my_own_validation( $pass, $fields, $values, $form ) {
if ( $form === 'registration' ) {
$email = isset( $values['register']['user_email'] ) ? $values['register']['user_email'] : false;
if ( $email ) {
$domain = substr( $email, strpos( $email, '@' ) + 1 );
$allowed_domains = [
'icloud.com',
];
if ( ! in_array( $domain, $allowed_domains, true ) ) {
return new WP_Error( 'email-validation-error', 'Your error message goes here.' );
}
}
}
return $pass;
}
add_filter( 'submit_wpum_form_validate_fields', 'wpum_my_own_validation', 20, 4 );
Remember to modify the $allowed_domains
variable with the list of domains you wish to allow.