Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Blocking free email accounts for online form Re: Blocking free email accounts for online form

#98513
kblake
Participant

Thanks for the help and suggestions. Since this is a public site and there are many schools with their own domain, I am thinking just adding a few common email domains would make the most sense.

I think I’m getting closer to resolving this. I added “if(strpos(strtolower…” (see code below) but I get the error “Parse error: syntax error, unexpected” when using this code. Any ideas on why? Or what I am missing?


function wpcf7_text_validation_filter( $result, $tag ) {
$type = $tag;
$name = $tag;

$_POST[$name] = trim( strtr( (string) $_POST[$name], "n", " " ) );
if ( 'text*' == $type ) {
if ( '' == $_POST[$name] ) {
$result = false;
$result[$name] = wpcf7_get_message( 'invalid_required' );
}
}

if ( 'email' == $type || 'email*' == $type ) {
if ( 'email*' == $type && '' == $_POST[$name] ) {
$result = false;
$result[$name] = wpcf7_get_message( 'invalid_required' );
}

if(strpos(strtolower( '' != $_POST[$name] && ! is_email( $_POST[$name] ),'[email protected]') ){
$result = false;
$result[$name] = wpcf7_get_message( 'invalid_email' );
}
}elseif ( '' != $_POST[$name] && ! is_email( $_POST[$name] ) ) {
$result = false;
$result[$name] = wpcf7_get_message( 'invalid_email' );
}
}
return $result;
}
?>