Created
June 6, 2012 13:55
-
-
Save benedmunds/2881995 to your computer and use it in GitHub Desktop.
Ion Auth - Restrict emails when registering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MODEL | |
class users_m() | |
{ | |
function restrict_email() | |
{ | |
$emails = array('[email protected]', '[email protected]'); | |
$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