Hello, We had an "add_filter" set up for validation that used to work before upgrading to the latest version. We can not figure out why it isnt working now. Could you please help us figure out why? I have copied and pasted the code below.
[php]
//code
add_filter('gform_validation', 'custom_validation');
function custom_validation($validation_result){
#value = $_POST['input_9'];
$em=$value;
$ar=split("@",$em);
$domain = explode("@", $value);
$domain = $domain[(count($domain)-1)];
$blacklist = array('yahoo-inc.com');
if (in_array($domain, $blacklist)) {
echo $ar[1];
// set the form validation to false
$validation_result["is_valid"] = false;
//finding Field with ID of 1 and marking it as failed validation
foreach($validation_result["form"]["fields"] as &$field){
//NOTE: replace 1 with the field you would like to validate
if($field["id"] == "9"){
$field["failed_validation"] = true;
$field["validation_message"] = "Only commercial (non-free) Email accounts are accepted.";
break;
}
}
}
return $validation_result;
}
// END CODE