without mail

Permalink
Hey,

I am developing a private site for a community.
The fact is that there are a lot of clients who don't have a mail address.
My question is if there is no possibility to avoid the need of a mail address when registering.

best regards,

Stefaan De Reu

stedereu
 
hutman replied on at Permalink Reply
hutman
If you override the Register controller you can comment out the email address validation bits and if they don't have an email address just populate it with a random email address.

The only drawback is that Messages and Forgot Password requests won't work.
stedereu replied on at Permalink Reply
stedereu
hey hutman,

Thanks for your reply.
can you be more specific in whitch file I have to look for this vallidation?

best regards,

Stefaan De Reu
hutman replied on at Permalink Reply
hutman
You would want to copy concrete/controllers/single_page/register.php to application/controllers/single_page/register.php then (looking at 8.2.1) change or remove these lines

if (!$vals->email($_POST['uEmail'])) {
    $e->add(t('Invalid email address provided.'));
} elseif (!$valc->isUniqueEmail($_POST['uEmail'])) {
    $e->add(t('The email address %s is already in use. Please choose another.', $_POST['uEmail']));
}

And in there set the "default" email address if they didn't fill one in on the form.

Probably something like this
if($vals->empty($_POST['uEmail'])){
    $rand = rand();
    $_POST['uEmail'] = $rand.'@mailinator.com';
} else {
    if (!$vals->email($_POST['uEmail'])) {
        $e->add(t('Invalid email address provided.'));
    } elseif (!$valc->isUniqueEmail($_POST['uEmail'])) {
        $e->add(t('The email address %s is already in use. Please choose another.', $_POST['uEmail']));
    }
}