• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
community auth is_logged_in

How are people making use of the is_logged_in() function in Community Auth?

First I tried handling it in MY_Controller.php, redirecting the user to the user controller if not logged in but of course that doesn't work because the user controller extends MY_Controller.php. Hence, endless redirection.

Then I tried putting the following in the index() method of one of my controllers (though I'd rather not have to repeat this code on all my controllers which will all require the user to be logged in):
if (!$this->is_logged_in()) {

...and for whatever reason, even if I'm logged in, I never get past the user controller, ie. always redirecting there.

This all came about because the initial problem I found was that when I returned to work on the site after some time (after the session expired), my controller was looking for $this->auth_user_id, failing, and spitting out an ugly PHP Notice.

There must be a simple and elegant solution that somehow eludes me this morning.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.