Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save greenhornet79/1eda3a3702b9fd824a61619bac869774 to your computer and use it in GitHub Desktop.
Save greenhornet79/1eda3a3702b9fd824a61619bac869774 to your computer and use it in GitHub Desktop.
<?php
add_filter('leaky_paywall_account_setup_validation', 'zeen_validate_email_blacklist', 20, 2 );
function zeen_validate_email_blacklist($errors, $fields)
{
// edit to the domains/strings you would like to block from registering
$blacklist = array(
'gmail',
'yahoo',
'colo'
);
$email = $fields['email_address'];
// edit the error message you would like to display
$message = 'You have entered a blocked email address. Please use a different one.';
foreach( $blacklist as $needle ) {
if ( strpos( $email, $needle) !== false ) {
$errors['email'] = array(
'message' => $message,
);
}
}
return $errors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment