Hi @ozmatflc,
Thank you for reaching out, we’re glad to assist you.
While achieving this directly through the plugin’s inbuilt options isn’t possible, it can be accomplished through custom PHP code.
Below is an example of how to do it:
add_filter( 'ig_es_validate_subscribers_data', 'exp_cc_allow_subscription_from_allowed_domain_list' );
function exp_cc_allow_subscription_from_allowed_domain_list( $data ) {
$form_data = wp_unslash( $_POST );
if ( ! empty( $form_data['esfpx_email'] ) ) {
$email = $form_data['esfpx_email'];
$rev_email = strrev( $email );
$allowed_domains = array(
'example.com'
);
$domain_allowed = false;
foreach ( $allowed_domains as $domain ) {
$domain = trim( $domain );
if ( ! empty( $domain ) && strpos( $rev_email, strrev( $domain ) ) === 0 ) {
$email_parts = explode( '@', $email );
if ( ! empty( $email_parts[1] ) ) {
$email_domain = $email_parts[1];
if ( $email_domain === $domain ) {
$domain_allowed = true;
break;
}
}
}
}
if ( ! $domain_allowed ) {
$data = array( 'status' => 'ERROR', 'message' => 'es_email_address_blocked' );
return $data;
}
}
return $data;
}
Note: Change allowed domain list in the $allowed_domains variable according to the requirements.
You can use the above code into the functions.php file of your currently active child theme or use the “Code Snippets” plugin for easy integration.
Let me know how it goes on your side.
Cheers!