I use Tank Auth to manage users in my CI 1.7.3 application. Everything works fine, but I'm trying to set flash_message to display when the user logs out. The problem is that the function $this->tank_auth->logout(); destroys the session. I changed the exit function in the Tank Auth library to look like this:
function logout() { $this->delete_autologin(); // See http://codeigniter.com/forums/viewreply/662369/ as the reason for the next line $user_session_data = array('user_id' => '', 'username' => '', 'status' => ''); $this->ci->session->set_userdata($user_session_data); $this->ci->session->unset_userdata($user_session_data); }
Earlier it was
function logout() { $this->delete_autologin(); // See http://codeigniter.com/forums/viewreply/662369/ as the reason for the next line $this->ci->session->set_userdata(array('user_id' => '', 'username' => '', 'status' => '')); $this->ci->session->sess_destroy(); }
In my controller I have
function logout(){ if ($this->tank_auth->is_logged_in()) { // logged in $this->session->set_flashdata('status_message', $this->lang->line('auth_message_logged_out')); $this->tank_auth->logout(); redirect(''); }
}
If I remove the function $this->tank_auth->logout(); , the message is displayed in order. I'm sure this is a simple session issue
source share