[eluser]stml[/eluser]
I'm using the Tank Auth library in my application, and alongside the recorded username, email address, I want to add the users postcode (zip code).
I've added this requirement to the form and validated it correctly, but I'm having trouble passing the information to the create_user() method which enters it in the DB.
The create_user() method is called from controllers/auth.php:
Code:
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'),
$this->form_validation->set_value('postcode'),
$email_activation))) { // success
...
I've added the postcode value in there, and tested it's correct but when I look at the data array passed to models/tank_auth/users.php:
Code:
function create_user($data, $activated = TRUE) {
$data['created'] = date('Y-m-d H:i:s');
$data['activated'] = $activated ? 1 : 0;
if ($this->db->insert(self::TABLE, $data)) {
$user_id = $this->db->insert_id();
if ($activated) $this->create_profile($user_id);
return array('user_id' => $user_id);
}
return NULL;
}
The $data array only contains the username, email and password. It also contains the last_ip, and the email validation key - but no postcode.
I think I'm setting this up wrong, but I'm not sure how this $data array is constructed.
Can anyone tell me where I'm going wrong? Many thanks.