Skip to content

Instantly share code, notes, and snippets.

@nciske
Created November 27, 2013 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nciske/7684378 to your computer and use it in GitHub Desktop.
Save nciske/7684378 to your computer and use it in GitHub Desktop.
Blacklist emails in WordPress to Lead for Salesforce CRM v2.2+
<?php
add_filter('sfwp2l_validate_field','block_non_biz_emails', 10, 4);
function block_non_biz_emails( $error, $id, $val, $field ){
if( $id == 'email' ){
$non_biz_domains = array( 'gmail.com', 'yahoo.com', 'hotmail.com', 'aol.com' );
$domain = array_pop(explode('@', $val));
if( in_array( $domain, $non_biz_domains ) ){
$error['valid'] = false;
$error['message'] = 'Please enter a business email addresss.';
}
}
return $error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment