Home    Articles

 

How to set xenforo user log-in time or increase session lifetime

 

In order to increase the user login lifetime on your xenforo forum you have to change the lifetime variable from Sessions.php file.

To do that, open the file /library/XenForo/Session.php

Search for this code and change 3600 (1 hour ) values to 2592000 ( 30 days )

if (empty($config['admin']))
{
   $defaultConfig = array(
			'table' => 'xf_session',
			'cacheName' => 'session',
			'cookie' => 'session',
			'lifetime' => 3600
			);
}
else
{
    $defaultConfig = array(
			'table' => 'xf_session_admin',
			'cacheName' => 'session_admin',
			'cookie' => 'session_admin',
			'lifetime' => (XenForo_Application::debugMode() ? 86400: 3600) // longer lifetime in debug mode to get in the way less
			);
     unset($config['admin']);
}

ps:  ...this is a variable that will be lost if the xenforo will be upgraded.

by