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.

Only let users register if email is on a certain domain

edited June 2011 in Vanilla 2.0 - 2.8
So I'm not really new to PHP but I'm new to vanilla forum. I was wondering if there was a way to make it so users with email addresses on certain domains only could register. I can make a plugin but I have no clue where to start, what functions to call, or what files I would need to modify.

Comments

  • ToddTodd Chief Product Officer Vanilla Staff
    First off, have a look at the plugin quick start here.

    There is actually an event that we fire specifically to stop registration.

    public function UserModel_BeforeRegister_Handler($Sender, $Args) {
    if (!StringEndsWith($Args['User'], '@somedomain.com')) {
    $Args['Valid'] = FALSE;
    $Sender->Form->AddError("You can't register with that email address.");
    }
    }
    I'm pretty sure this stuff is available only in the current 2.0.18 branch so you'll have to work off of that.
  • Hi,
    The registration process is stopped but I get this message:
    Fatal error: Call to a member function AddError() on a non-object in ....
Sign In or Register to comment.