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.
different accounts, but same e-mail -- HOWTO DELETE
I have some users that fail to authenticate their account and therefor they have multiple accounts using the same e-mail address.
How can I eliminate the problem of a user signing up more than once using the same e-mail address?
How can I eliminate the problem of a user signing up more than once using the same e-mail address?
0
This discussion has been closed.
Comments
Function DuplicateEmailCheck(&$UserManager) { // Ensure the email address isn't already used by another user $u = &$UserManager->DelegateParameters['User']; $s = $UserManager->Context->ObjectFactory->NewContextObject($UserManager->Context, 'SqlBuilder'); $s->SetMainTable('User', 'u'); $s->AddSelect('UserID', 'u'); $s->AddWhere('u', 'Email', '', FormatStringForDatabaseInput($u->Email), '='); $MatchCount = 0; $result = $UserManager->Context->Database->Select($s, 'DuplicateEmailCheck', 'CreateUser', 'A fatal error occurred while validating your input.'); $MatchCount = $UserManager->Context->Database->RowCount($result); if ($MatchCount > 0) $UserManager->Context->WarningCollector->Add('That email address has already been used to create an account'); } $Context->AddToDelegate('UserManager', 'PostValidation', 'DuplicateEmailCheck'); ?>
Note that there should be only one ?> at the bottom of the file with nothing after it. There would be an extra one if you copied every line from the wiki extension template.
I haven't put this through any testing, (I'll turn it into a full blown add-on later) so if it doesn't work wait for the add-on release.
edit: Changed $this->Context to $UserManager->Context, caused lots of ugly PHP errors. But the code works now!