Hi,
I am currently trying to add address details to the registration system on ion auth and struggling to pull in data to the meta db.
I am adding fields to the $additional data array however they are not pulling through.
Can anyone point me in the right direction? I have noticed this function: $this->ion_auth->extra_set(’‘, ‘’);
Do I need to assign the additional fields using this, if so where?
Here is my registration function - you can see I have added the ‘address’ field:
//validate form input
$this->form_validation->set_rules('first_name', 'First Name', 'required|xss_clean');
$this->form_validation->set_rules('last_name', 'Last Name', 'required|xss_clean');
$this->form_validation->set_rules('email', 'Email Address', 'required|valid_email');
$this->form_validation->set_rules('phone1', 'Phone Number', 'required|xss_clean|min_length[3]|max_length[11]');
$this->form_validation->set_rules('company', 'Company Name', 'required|xss_clean');
$this->form_validation->set_rules('address', 'Address', 'required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'required|min_length['.$this->config->item('min_password_length', 'ion_auth').']|max_length['.$this->config->item('max_password_length', 'ion_auth').']|matches[password_confirm]');
$this->form_validation->set_rules('password_confirm', 'Password Confirmation', 'required');
if ($this->form_validation->run() == true) {
$username = strtolower($this->input->post('first_name')).' '.strtolower($this->input->post('last_name'));
$email = $this->input->post('email');
$password = $this->input->post('password');
$additional_data = array('first_name' => $this->input->post('first_name'),
'last_name' => $this->input->post('last_name'),
'address' => $this->input->post('address') ,
'company' => $this->input->post('company'),
'phone' => $this->input->post('phone1'),
);
}
if ($this->form_validation->run() == true && $this->ion_auth->register($username,$password,$email,$additional_data)) { //check to see if we are creating the user
//redirect them back to the admin page
$this->session->set_flashdata('message', "Thanks for registering, please login");
redirect("/auth/login/", 'refresh');
}
All help most appreciated.
Martyn.