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

edited July 2007 in Vanilla 1.0 Help
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?


  • Options
    Anyone have an idea on this???
  • Options
    edited July 2007
    Paste this in a extension file, and you should be good to go: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!
  • Options
    raykrayk New
    edited July 2007
    Seems to be working :)!
  • Options
    FYI: I added auto-linkting to forgot password page in the code for the actual extension I uploaded that isn't used above.
  • Options
    Awesome! Thanks, we'll give this a shot soon.
  • Options
    WallPhone, Might I be able to get your feedback on this one too?
This discussion has been closed.