Creating Email Domain Filter

Home Forums Quform WordPress Creating Email Domain Filter

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31377
    darkspark
    Participant

    Hi Ally,

    I’m trying to setup a plugin filter to block specific email domains, I lifted this up from a forum topic way back. I can’t figure out how to set it up so this is going to be the default action for all forms. Will this block subdomains as well like @example.gmail.com? FYI I’m still using v1.10.

    
    function block_free_email_addresses($valid, $value, $element)
    {
        $pattern = '/@(gmail|googlemail|hotmail|live|msn|outlook|yahoo|ymail|aol)\./i';
    
        if (preg_match($pattern, $value)) {
            $element->addError('Please provide your business email.');
            $valid = false;
        }
    
        return $valid;
    }
    add_filter('iphorm_element_valid_iphorm_1_3', 'block_free_email_addresses', 10, 3);
    

    Thank you for looking into this, really appreciate the help.

    Darkspark

    • This topic was modified 3 months, 3 weeks ago by darkspark.
    #31412
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2020 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy