• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Email Validation Rule

Email Validation Rule 1.0.0

No permission to download
Use custom email validation rule such as regular expression.
Compatible XF 1.x versions
1.5
License
Creative Commons license
Visible branding
No
No download is needed :)
___________________


Do you need regular expression to validate user's email?
Now you can do it, using a file edit :)
  • Please backup the file before modifying
You must edit this file :
Code:
/library/XenForo/Helper/Email.php
Find these lines :
PHP:
    public static function isEmailValid($email)
    {
        $validator = new Zend_Validate_EmailAddress();
        $validator->getHostnameValidator()
            ->setValidateTld(false)
            ->setValidateIdn(false);
        return $validator->isValid($email);
    }
Change as you wish, such as :

(this pattern is just a sample. Do not use it without knowing what it means)
PHP:
    public static function isEmailValid($email)
    {
        if ('' != $email) {
            $your_own_pattern = '/^([0-9]+)/iU';
            if (preg_match($your_own_pattern, $email)) {
                return false;
            }
        }

        $validator = new Zend_Validate_EmailAddress();
        $validator->getHostnameValidator()
            ->setValidateTld(false)
            ->setValidateIdn(false);
        return $validator->isValid($email);
    }
Author
semprot
Downloads
15
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from semprot