Created
November 27, 2013 22:39
-
-
Save nciske/7684378 to your computer and use it in GitHub Desktop.
Blacklist emails in WordPress to Lead for Salesforce CRM v2.2+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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