Skip to content

Instantly share code, notes, and snippets.

@benedmunds
Created June 6, 2012 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benedmunds/2881995 to your computer and use it in GitHub Desktop.
Save benedmunds/2881995 to your computer and use it in GitHub Desktop.
Ion Auth - Restrict emails when registering
//MODEL
class users_m()
{
function restrict_email()
{
$emails = array('test@test.com', 'test2@test2.com');
$this->db->where_in($emails);
}
}
//CONTROLLER
function register_user()
{
//set the hook
$this->ion_auth->set_hook('pre_register', 'restrict_emails', $this->users_m, 'restrict_email');
//other stuff...
$user = array(
'email' => $this->input->post('email'),
'password' => $this->input->post('password'),
...
);
//before the user is created the hook will be called automatically
$this->ion_auth->register(...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment