Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Restricting Membership by Email Domain . . .
Before I start delving into the vexed question of how to do this, I would like to know if anybody else has first. Specifically, I would like to restrict membership to a forum to email addresses for a given domain (e.g. example.org). If nobody has implemented this yet, if you'll give me a nudge in the right direction, I'll take it on.
Regards,
Ben Wilson
0
Comments
Validate($this->Context->GetDefinition('EmailLower'), 1, $SafeUser->Email, 200, '(.+)@(.+)\.(.+)', $this->Context);
to
Validate($this->Context->GetDefinition('EmailLower'), 1, $SafeUser->Email, 200, '(.+)@(gmail)\.(com)', $this->Context);
where "gmail" and "com" is the domain you want to require.
This is also probably something that will get overwritten if/when you update Vanilla.
Sorry for the lamer question, but the more I understand this app, the better. And as of now (as I'm sure you can tell) it's all a bit of a mystery to me.
... function GoogleMemberOnly(&$UserManager) { $User= &$UserManager->DelegateParameters['User']; Validate($UserManager->Context->GetDefinition('EmailLower'), 1, $User->Email, 200, '(.+)@(gmail)\.(com)', $UserManager->Context); } $Context->AddToDelegate('UserManager', 'PostValidation ', 'GoogleMemberOnly');
Following Dinoboff's suggestion, I created this php file:
<?php
/*
Extension Name: RestrictMembership
Extension Url: http://vanillaforums.org/discussion/comment/40894/#Comment_40894
Description: Restricts membership to only those with an @gmail.com email address.
Version: 0.1
Author: Dinoboff
Author Url: http://vanillaforums.org/profile/Dinoboff
*/
function GoogleMemberOnly(&$UserManager) { $User= &$UserManager->DelegateParameters['User'];
Validate($UserManager->Context->GetDefinition('EmailLower'), 1, $User->Email, 200, '(.+)@(gmail)\.(com)', $UserManager->Context); }
$Context->AddToDelegate('UserManager', 'PostValidation ', 'GoogleMemberOnly');
?>
I called it default.php and added it to its own folder ("RestrictMembership") in the extensions folder. I changed all appearances of "gmail" and "com" to the only email domain that should be allowed.
The extension shows up where it should on the Vanilla extensions page, and Vanilla allows me tick the box enabling it. But when I tested it by attempting to sign up as a new member with a domain other than the one I changed "gmail.com" to, I was allowed in. What did I forget to do?