I am using the following function to check for blacklisted email domains on BuddyPress registration.....
function bp_as_restrict_signup_domains( $email_blacklist_result ) {
$banned = array(
'test.com',
'spammer.com'
);
$error = 'Your email domain has been the source of spam. Please use another email address.';
$email = $email_blacklist_result['user_email'];
$domain = array_pop(explode('@', $email));
if ( in_array($domain, $banned))
{
$email_blacklist_result['errors']->add('user_email', __($error, 'bp-restrict-email-domains' ) );
};
return $email_blacklist_result;
}
add_filter( 'bp_core_validate_user_signup', 'bp_as_restrict_signup_domains' );
What I would like to do is provide the user with some feedback that their email has been rejected, how can I add a variable to this function that I can retrieve in the template?
Something like $bl_result = blacklisted
?
In your register template, you should see:
<?php do_action( 'template_notices' ); ?>
You should be able to send messages to it like so:
if ( in_array($domain, $banned))
{
$email_blacklist_result['errors']->add('user_email', __($error, 'bp-restrict-email-domains' ) );
bp_core_add_message( 'Your email has been rejected' );
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.