// Set Required Fields. $this->ci->auth_model->set($data); if ( !empty($this->optional) ) { // Loop through each additional column and // map them to a input with the same key // and add it to an array. foreach( $this->optional as $key => $value) { if ( !$this->ci->db->field_exists($key, $this->usertable) ) { $fields = array($key => $value); $this->ci->dbforge->add_column($this->usertable, $fields); } $optional[$key] = $this->ci->input->post($key); } // Set Optional Fields. $this->ci->auth_model->set($optional); } // No email validation required. if ( !$this->emailver ) { // Register. $this->ci->auth_model->insert($this->usertable);