谁能帮帮我,我正在使用 Buddypress/wordpress,我想禁止一些域扩展,例如 .pl、.ru、.asia。我尝试了以下适用于电子邮件域但不适用于扩展的功能。
function my_bp_ban_domains( $result ) {
$banned = array('.ru', '.pl');
$error = 'God catch you brah !!!, Spammers are not welcome here, try your luck elsewhere.';
$email = $result['user_email'];
$domain = array_pop(explode('@', $email));
if ( in_array($domain, $banned)) {
$result['errors']->add('user_email', __($error, 'my_bp_ban_domains' ) );
};
return $result;
}
add_filter( 'bp_core_validate_user_signup', 'my_bp_ban_domains' );