An almost lost feature that was included in ez Form Calculator some versions ago is the email blacklist feature. This is useful if you want to block certain domains or single email addresses in form submissions preemptively.
In order to add email to the blacklist, open up your (child-) theme’s functions.php file and add the following code:
1 2 3 4 5 6 7 8 9 |
function ezfc_add_email_blacklist($blacklist) { $blacklist_array = array( "annoying.steve@annoying-steve.com", // block steve's email address "annoying-steve.com" // block all email addresses from steve's domain completely ); return array_merge($blacklist, $blacklist_array); } add_filter("ezfc_email_blacklist", "ezfc_add_email_blacklist"); |
The first array entry blocks a single email address whereas the second array entry blocks email addresses from an entire domain.
You can customize the error message like this:
1 2 3 4 |
function ezfc_email_blacklist_message($message) { return "Go away, Steve."; } add_filter("ezfc_email_blacklist_message", "ezfc_email_blacklist_message", 10, 1); |