Welcome Guest, Not a member yet? Register   Sign In
Logout and flashdata
#1

[eluser]victorche[/eluser]
Please, give me a hint about this case ... I've read all the user guide and I think I am not making a mistake, but anyway it is not working. Here is the problem.

My login is in the header, which means accesible trough all the site areas. After successful login, the header is changed and there is of course a logout link.

The code logic is like this ... I have My_Controller.php, which takes care for the login stuff.
Code:
class MY_Controller extends Controller {

    function MY_Controller () {
        parent::Controller();

        // Putting all the login stuff here ...
        if ( ! $this->auth->logged_in())
        {
                // Set some form rules ...
                $this->form_validation->set_rules('email', 'Email Address', 'required|valid_email');
                $this->form_validation->set_rules('password', 'Password', 'required');

                if ($this->form_validation->run() == true)
                {
                          // Making checks if the user is logging in successfully or not and setting some flashdata with info and error messages ...
                          $this->session->set_flashdata('message', $this->auth->errors());
                }
                // Let's display the messages ...
                $messages[] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message'); // This should catch the logout message too, but it is not :(
                $this->message->set($messages);
        }
        else
        {
             // The user is already logged in ...
        }

    }

}
I am also making a logout.php (controller), as my logout link is site.com/logout:
Code:
class Logout extends MY_Controller {

        function  __construct() {
              parent::Controller();
        }

        function index() {
              $this->auth->logout();
              $this->session->set_flashdata('message', $this->auth->messages()); // Here the logout message is set ...
              // echo $this->session->flashdata('message'); // If we echo here, the message is displayed

              // And this is the redirect, after which the message should be catched and displayed. But it is not :(
              redirect($this->config->item('base_url'), 'refresh');
        }

}
So, the explanation is in the comments. Any ideas why the logout message is not displayed?

Thanks in advance!


Messages In This Thread
Logout and flashdata - by El Forum - 10-08-2010, 07:02 AM
Logout and flashdata - by El Forum - 10-08-2010, 07:20 AM
Logout and flashdata - by El Forum - 10-08-2010, 07:22 AM
Logout and flashdata - by El Forum - 10-08-2010, 07:46 AM
Logout and flashdata - by El Forum - 10-08-2010, 07:58 AM
Logout and flashdata - by El Forum - 10-08-2010, 08:08 AM
Logout and flashdata - by El Forum - 10-08-2010, 08:25 AM
Logout and flashdata - by El Forum - 10-08-2010, 09:06 AM
Logout and flashdata - by El Forum - 10-08-2010, 09:21 AM
Logout and flashdata - by El Forum - 10-08-2010, 09:25 AM
Logout and flashdata - by El Forum - 10-08-2010, 11:05 AM
Logout and flashdata - by El Forum - 10-08-2010, 11:05 AM
Logout and flashdata - by El Forum - 10-08-2010, 11:09 AM
Logout and flashdata - by El Forum - 10-08-2010, 02:25 PM
Logout and flashdata - by El Forum - 10-08-2010, 04:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB