避免向特定电子邮件提供商注册用户

时间:2015-02-28 作者:Castiblanco

我一直受到垃圾邮件攻击,有人每天都在创建大量用户,可能是一个机器人,所有这些用户都有相同的电子邮件提供商,我有没有办法避免任何人使用特定的电子邮件提供商创建用户。

2 个回复
最合适的回答,由SO网友:Saurabh Shukla 整理而成

请参见此挂钩:register_post

add_action(\'register_post\', \'ban_email_2334\', 10, 3);

function ban_email_2334( $username, $email, $errors ){

    $result = array();

    // check if email is from the provider you wish to ban
    preg_match(\'/bannedprovider.com/i\', $email, $result);

    if( !empty( $result )){
        $errors->add(\'spam_email\', __( \'Some choicest abuses you might want to pass on\' ));
    }

    return;

}
这将引发错误并阻止注册

SO网友:Jason Murray

最简单的解决方案是使用插件,我认为:

Ban Hammer 提供您所需的功能。

结束

相关推荐

Search with filters and title

我想搜索custom_post 按标题和ACF字段。所以,我用了WP_Query WordPress函数,但我不能按标题过滤,只能按过滤器过滤。当我提交表单时,我有这样的URL:http://example.com/?s=titre&filter1=condition1&filter2=condition2&filter3=condition3 我的代码:$title = $_GET[\'s\']; $args = array( \'pagenam