Jump to content

Session time for logged in user


Recommended Posts

Take a look in /site/config.php. A few lines down you'll see this line:

* sessionExpireSeconds: how many seconds of inactivity before session expires
$config->sessionExpireSeconds = 86400;

Change that to adjust how long you want sessions to last.

Link to comment
Share on other sites

You'd have to use a little bit different approach because a session has to be active before we know who the user is. The session hasn't yet started when the config file is being loaded. So you'd detect who the user is somewhere else (like in your main site template) and then set a cookie before any output starts:

setcookie('guest', $user->isGuest() ? 1 : 0); 

Then detect the cookie in your config.php:

$config->sessionExpireSeconds = empty($_COOKIE['guest']) ? 86400 : 23200; 

You wouldn't want to use this method for anything security related, but session time is really not a security concern I don't think.

  • Like 1
Link to comment
Share on other sites

  • 7 years later...


I set this sessionExpireSeconds to 432000 in my confog.php

$config->sessionExpireSeconds = 432000;

I expected to be not automatically logged out for 5 days.
But i have to log in the very next day or even earlier.

Do i need to install another modul or did i made a mistake?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...