Hello @mikesuccess ,
We don’t have a snippet that would provide exactly what you need. However, we have a small code that would only allow emails from your chosen domain:
add_filter( 'forminator_custom_form_submit_errors', function( $submit_errors, $form_id, $field_data_array ){
$email_field = 'email-1';
$allowed_domain = 'thedomain.com';
$email = isset( $_POST[ $email_field ] ) ? $_POST[ $email_field ] : false;
if ( ! $email ) {
return $submit_errors;
}
list( $user, $domain ) = explode( '@', $email );
if ( $domain !== $allowed_domain ) {
$submit_errors[][ $email_field ] = __( 'Your email address is not valid' );
}
return $submit_errors;
}, 20, 3 );
You can use it as an MU plugin https://premium.wpmudev.org/docs/getting-started/download-wpmu-dev-plugins-themes/#installing-mu-plugins
kind regards,
Kasia