benedmunds / CodeIgniter-Ion-Auth

Simple and Lightweight Auth System for CodeIgniter
http://benedmunds.com/ion_auth/
MIT License
2.34k stars 1.14k forks source link

username not registered in database #1533

Closed federicovilla closed 3 years ago

federicovilla commented 3 years ago

I've downloaded latest Ion Auth 3 library. Trying to create new user I got in trouble with the register function: the user is succesfully created using the code below:

$user_id = $this->ion_auth->register($username, $password, $email, $additional_data, $group_ids)

The weird things is that $username is not passed and added into the database and I'm sure the variable is correctly set since in my scrip the $usernamne is set as following:

$username = $this->input->post('first_name') . '_' . $this->input->post('last_name');

Of course first_name and last_name are correctly added into the users table using the following code:

$additional_data = array( 'first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'), );

What's wrong? Thanks a lot for any help

benedmunds commented 3 years ago

Try Var dumping the username inside of the register method to see what it has there.

federicovilla commented 3 years ago

Hi Ben, I added the $username variable into the additional_data array, so now it works fine. It's weird since in previous project I used the code above and was working as expected...maybe something has been changed in the library and I didn't realize.