Created
September 3, 2024 16:29
-
-
Save greenhornet79/1eda3a3702b9fd824a61619bac869774 to your computer and use it in GitHub Desktop.
This file contains hidden or 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('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