Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Restrict email domains
Hi, I want to restrict the user registration to an specific domain (for example only @gmail.com), is there any way to do this?
Thank you!
Thank you!
Tagged:
0
Comments
Plugin quickstart: http://vanillaforums.org/docs/pluginquickstart
class MyMembershipPlugin extends Gdn_Plugin {
public function UserModel_BeforeRegister_Handler($Sender) {
$email = $this->EventArguments['User'][Email];
if (strstr($email, '@mydomain.com') === false) {
$this->EventArguments['Valid'] = false;
}
}
}
I don't know where is the email. I tried print_r($this->EventArguments['User']) to get the user email but it shows nothing because i'm redirected to home. So this is not working at all. Can you help me please? I'm lost.