Welcome Guest, Not a member yet? Register   Sign In
IonAuth, server error?
#1

[eluser]solid9[/eluser]
Hi guys

I'm trying to test the register() method in ion_auth_model.php
and these are the codes below,
Code:
public function process_new_user()
{
  //validate data input first
  $this->form_validation->set_rules('fname', 'First Name', 'required');
  $this->form_validation->set_rules('lname', 'Last Name', 'required');
  $this->form_validation->set_rules('username', 'Username', 'required|is_unique[users.username]');
  $this->form_validation->set_rules('password', 'Password', 'required');
  $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');

  //if validation has an error display form again.
  if ($this->form_validation->run() == FALSE)
   {
    //$data_midnav['rows'] = $this->data_model->getAll();
    $this->data['midnav'] = $this->load->view('create_user_form', '', TRUE);
    
    $this->load->view('create_user_form', $this->data);
   }
   else //if validation is successful register user and email account info to user.
   {
    $username = $this->input->post('username', TRUE);
    $password = $this->input->post('password', TRUE);
    $email = $this->input->post('email', TRUE);
    $additional_data = array(
          'first_name' => $this->input->post('fname', TRUE),
          'last_name' => $this->input->post('lname', TRUE),
          );
    $group = array(); // Sets user to admin. No need for array('1', '2') as user is always set to member by default

    $this->ion_auth_model->register($username, $password, $email, $additional_data, $group)    

    
    //email userinfo to user
        
    $this->load->view('create_user_success');
   }  
}


The error was "HTTP error Internal Server Error"
Is there something wrong that you can see in my codes?
specially the register() method I called?

Thanks in advanced.


#2

[eluser]meigwilym[/eluser]
This seems to be ok. You'll need to check your error logs for more information.

Mei
#3

[eluser]pbflash[/eluser]
I would guess that it is either the comma at the end of this line:

'last_name' => $this->input->post('lname', TRUE),

It's not needed as it's the last item in the list.

Or it could be the missing ; after this line:

$this->ion_auth_model->register($username, $password, $email, $additional_data, $group)




Theme © iAndrew 2016 - Forum software by © MyBB