5

How do I make a javascript notice in my Joomla page when session is about to expire? Also still not sure why Joomla 3.4.5 session is not expiring or redirecting page to my home page after setting my session to 5 mins in session lifetime of Global config? I logged in as a regular user. I have 2 modules using a login module. One is a link(top of the page) for modal login and the other one just to display the username in the body of the page (with the form hidden). Any suggestion?

5
  • Hi iamoscarlito, welcome to JSE:) I'd consider splitting your post into 2 separate questions as they are not directly related.
    – TryHarder
    Commented Jan 7, 2016 at 4:42
  • Regarding Q1,I'm not sure if this is the best way to do it, but perhaps you could create a plugin that would get the session expire time onAfterInitialise() and then plug that into a javascript counter to popup just before session expired?
    – TryHarder
    Commented Jan 7, 2016 at 4:42
  • Regarding Q2, did you reload the page after 5 minutes and nothing happened or were you expecting it to automatically redirect?
    – TryHarder
    Commented Jan 7, 2016 at 4:42
  • On Q2, i did reload the page after 5 minutes and the user is still showing as logged in. I even tried the nightly builds (Joomla 3.5) and using the default template ProtoStar and it is behaving the same. Yes i was expecting it to re-direct to my homepage. Commented Jan 8, 2016 at 6:14
  • Thanks for the advise moomoochoo. I will separate it to 2 questions next time. Commented Jan 8, 2016 at 6:16

3 Answers 3

4

There's actually a free Joomla! extension that will do just this. It's called Session Keeper and you can view it in the JED here:

Session Keeper

It worked for my site when I utilized it, so hopefully it works for you as well! It allows you to set session lengths and display modal pop-ups when sessions start to expire. Hope it works for you!

Cheers,
-J

2
  • 1
    Hi J. The Session Keeper actually worked. I set the session lifetime to 7 in the Global Config while on Session keeper i set the countdown to start at 2 mins before the session ends. Only thing is it did not destroy the session of my user so i added a script in function _getRedirect() to destroy the user token. Thanks! Commented Jan 8, 2016 at 21:12
  • Glad to hear it @iamoscarlito! Glad you got it working! Commented Jan 10, 2016 at 23:24
4

Regarding why your session was not expiring, if you were on a page that had a Joomla login module, the session would never time out.

The Joomla login module enables keepalive for all pages where it appears.

REFERENCE: http://extensions.joomla.org/extension/session-keeper

0

I found a solution by editing the function _getRedirect() of the Extension Session Keeper (sessionkeeper.php). I just changed the return JRoute:: to destroy the user Session token and it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.