• Resolved pistolero

    (@pistolero85)


    Hello

    Thank you for the great plugin. Is it possible to add the feature something like “Email Blacklist”? I want to prevent registrations with disposable emails like mailinator.
    I just need a field to type blacklisted domains. During registration user is getting message “Your email has been banned”.
    I know that Ban Hammer plugin is doing the same but for default registration page. Not sure it will work with TML.

Viewing 5 replies - 1 through 5 (of 5 total)
  • TacoV

    (@tacov)

    Since TML leaves most hooks intact, I suspect Ban Hammer will work without problem. Did you try it yet?

    Otherwise, simple hook into the registration_errors filter
    https://codex.www.ads-software.com/Plugin_API/Filter_Reference/registration_errors
    For example, put this in functions.php (it’s untested):

    function disallow_banned_email_domains( $errors, $sanitized_user_login, $user_email ) {
        $blacklist = [
            'binkmail.com',
            'bobmail.info',
            'chammy.info',
            'devnullmail.com',
            'letthemeatspam.com',
            'mailinater.com',
            'mailinator.net',
            'mailinator2.com',
            'notmailinator.com',
            'reallymymail.com',
            'reconmail.com',
            'safetymail.info',
            'sendspamhere.com',
            'sogetthis.com',
            'spambooger.com',
            'spamherelots.com',
            'spamhereplease.com',
            'spamthisplease.com',
            'streetwisemail.com',
            'suremail.info',
            'thisisnotmyrealemail.com',
            'tradermail.info',
            'veryrealemail.com',
            'zippymail.info',
        ];
        list($name, $domain) = explode( '@', $user_email );
        if ( in_array( $domain, $blacklist ) ) {
            $errors->add( 'blacklisted_email', __( '<strong>ERROR</strong>: Your email has been banned.', 'my_textdomain' ) );
        }
        return $errors;
    }
    
    add_filter( 'registration_errors', 'disallow_banned_email_domains', 10, 3 );

    Don’t forget this is a arms race you will lose in the end if someone really really wants to register with a disposable e-mail address!

    Thread Starter pistolero

    (@pistolero85)

    Thank you TacoV. I’ll try both methods and reply.
    Will be awesome if plugin developer add such function.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    I’ll keep it in mind, @pistolero85! You rock, @tacov!

    Thread Starter pistolero

    (@pistolero85)

    Thank you for reply Jeff. This function will be very useful. I’m now working to change the plugin WP-Members to TML. Your plugin is much better for me.

    @tacov – Ban Hammer is working fine, recently tested. But your script isn’t working, getting errors

    TacoV

    (@tacov)

    Well, if you want the script to work, you should post what errors you get. But probably it’s better to stick to a full plugin, as this is probably way more full-featured.

    If you have an old php version maybe you should replace the new array notation
    […]
    with the old one:
    Array(…)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disposable emails (blacklist)’ is closed to new replies.