AnotherAndrew Posted December 8, 2011 Share Posted December 8, 2011 Is there a way to change the session time before a user is automatically logged off? I see that PW automatically logs off an admin user after a set amount of time, but what about a new user role that I created? Link to comment Share on other sites More sharing options...
ryan Posted December 8, 2011 Share Posted December 8, 2011 Take a look in /site/config.php. A few lines down you'll see this line: <?php /** * 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 More sharing options...
AnotherAndrew Posted December 8, 2011 Author Share Posted December 8, 2011 Is it possible to do this: if($user->isSuperuser()) $config->sessionExpireSeconds = 86400; else $config->sessionExpireSeconds = 23200; Link to comment Share on other sites More sharing options...
ryan Posted December 9, 2011 Share Posted December 9, 2011 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. 1 Link to comment Share on other sites More sharing options...
tires Posted October 16, 2019 Share Posted October 16, 2019 Hi! 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now