CodeIgniter Forums

Full Version: Using flashdata before userdata
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]rossmurphy[/eluser]
I have a login page that sets userdata once the user has logged in successfuly like this:

Code:
if (user_authenticated())
{
    $session_data['auth'] = TRUE;
    $session_data['userid'] = FGT01932434;
    
    $this->session->set_userdata($session_data);
}

I have found though, that if I use 'set_flashdata()' before I use set_userdata().. and then redirect(), the user data is never set. I thought it may be a problem with the redirect, but no.. if I do not set the flash data, everything works as expected.

I am using this to store form data before setting the userdata:

Code:
$this->session->set_flashdata('form_data', '$formdata');

Anyone come across this issue?

El Forum

[eluser]WanWizard[/eluser]
No, and pretty weird, since set_flashdata uses set_userdata to store the session variable.

Are you using cookie based sessions by any chance? They are limited in size, it could be that if you add flashdata before, the userdata doesn't fit anymore.