Require registration from specific e-mail domain

Started by sstretchh, January 10, 2010, 12:46:31 PM

Previous topic - Next topic

sstretchh

I haven't seen this feature yet, I have looked around for it. Does anyone know if there is a MOD that can make it so only certain people from a specific e-mail domains can only registrar ?

If not it would be a nice request if someone can build it if its not already out there. I searched for it before I posted and didn't find anything.

sstretchh

Does anyone else think this is a good idea or not ??

paisa

#2
I think is a fantastic idea!

I have also been looking for a way to enable access to a certain board according to their e-mail domain.

for instance if there is a member with a *@hotmail.com and *@yahoo.com they will automatically get access to a "special" board; however, if a user registers with any other email domain (i.e *@gmail.com) they will get access to everything in the forum except the "special" board.

It would be a great mod to add to the permissions area ;)
After reading all over the forum, all that I have found so far is how to forbid certain domains from registering to the forum
Any help is greatly appreciated. :)


"paisa"

paisa

I figure out how to only allow certain domains to register your forum...
Here is what I did in order to only let users register with hotmail, Gmail and yahoo accounts:
in the "Subs-Members.php" I added the following code

"elseif(!(preg_match("/yahoo/i" , $_POST['email'])) && !(preg_match("/gmail/i" , $_POST['email']))&& !(preg_match("/hotmail/i" , $_POST['email'])))
      fatal_error(sprintf($txt[Gdomains], $regOptions['username']), false); "(no quotes)

After the following code:
"fatal_error(sprintf($txt[500], $regOptions['username']), false);  "(no quotes)

then I went to login.english.php and added the following line:

"$txt[Gdomains] = 'only gmail, yahoo and hotmail accounts are allowed.';"(no quotes)
after the following code:

"$txt[500] = 'Please enter a valid email address, %s.';"(no quotes)

Again, I am new at smf but the previous code seemed to work very well for me, I hope it helps someone else.

"paisa"




Arantor

Thanks for the tip. Note that you can post code using the [code] like so:

elseif(!(preg_match("/yahoo/i" , $_POST['email'])) && !(preg_match("/gmail/i" , $_POST['email']))&& !(preg_match("/hotmail/i" , $_POST['email'])))
      fatal_error(sprintf($txt['Gdomains'], $regOptions['username']), false);


$txt['Gdomains'] = 'only gmail, yahoo and hotmail accounts are allowed.';

$txt[500] = 'Please enter a valid email address, %s.';

Oh, and I fixed the code not to generate errors about undefined constant Gdomains...
Holder of controversial views, all of which my own.



paisa

Quote from: Arantor on April 12, 2010, 05:25:00 PM
Thanks for the tip. Note that you can post code using the [code] like so:...
...Oh, and I fixed the code not to generate errors about undefined constant Gdomains...

Oooops I completely forgot to put the single quotes on Gdomains  :-[
Thanks for being such a diligent individual :)
I will make sure to use the [code] snippet when I post code...(I had no clue about it)

Quote from: flapjack on April 12, 2010, 06:05:42 PM
http://custom.simplemachines.org/mods/index.php?mod=1493
Flapjack, that is exactly what I needed... I don't know how I missed it in the search  :-[
Oh well... mine is customized to a personalized message  :P
Thanks for posting the link!

I am loving SMF and you guys rock!
"paisa"

Norv

Good to see you got the problem solved.

This won't be a default SMF feature, seeing that it's not really requested and it seems to address a quite particular need.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Advertisement: