I\'ve been working with the Tank Auth library all day and have a question about it. I added two fields to the registration form: first_name and last_name respectively and I\
What You should do is put the two columns you want in the user_profiles table, then add a function to the models/tank_auth/users.php with something like:
function UpdateProfileInfo ($userID, $firstname, $lastname)
{
return $this->db->update('user_profiles', array('firstname'=>$firstname, 'lastname'=>$lastname), array('user_id' => $userID));
}
Then replace (in /libraries/Tank_auth.php)
function create_user($username, $email, $password, $email_activation)
With
function create_user($username, $email, $password, $email_activation, $userInfo)
Then right beneath (in /libraries/Tank_auth.php)
if (!is_null($res = $this->ci->users->create_user($data, !$email_activation))) {
Add
$this->users->UpdateProfileInfo($userInfo["firstname"],$userInfo["lastname"]);
Then replace (in /controllers/auth.php)
if ($this->form_validation->run()) { // validation ok
if (!is_null($data = $this->tank_auth->create_user(
$use_username ? $this->form_validation->set_value('username') : '',
$this->form_validation->set_value('email'),
$this->form_validation->set_value('password'),
$email_activation))) { // success
with:
$userInfo["firstname"] = $this->form_validation->set_value("firstname");
$userInfo["lastname"] = $this->form_validation->set_value("lastname");
if ($this->form_validation->run()) { // validation ok
if (!is_null($data = $this->tank_auth->create_user(
$use_username ? $this->form_validation->set_value('username') : '',
$this->form_validation->set_value('email'),
$this->form_validation->set_value('password'),
$email_activation, $userInfo))) { // success
This isn't tested though it should work, tell me how it goes
Max