• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Add-on Online Status Timeout

xmlxp

Active member
#1
As you know Online Status Timeout option for xenforo is limited to 60 minutes. I would like to find add-on that unlimit Online Status Timeout same as vBulletin.
 

Akinak

Well-known member
#5
Online Status Timeout is just time, in which set cookie with session_id.
This time in code, XenForo_Session (\library\XenForo\Session.php)
Find this code:
Code:
public function __construct(array $config = array(), Zend_Cache_Core $cache = null, Zend_Db_Adapter_Abstract $db = null)
    {
        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']);
        }
'lifetime' => 3600 - it is what You need. Just change 3600 to You time.
As for addon for this, I dont know how to extends this class so can not make addon.
 

xmlxp

Active member
#6
Thanks Akinak

I already change ( 'lifetime' => 3600) and (max value) that @Jarod suggested to somthing different and it didnt work out, its more complicated
 

Akinak

Well-known member
#7
Thanks Akinak

I already change ( 'lifetime' => 3600) and (max value) that @Jarod suggested to somthing different and it didnt work out, its more complicated
Cockies delete when you close brouser or when time left. I test on my forum. Can You give link to you forum?
I suspect that we do not understand each other :)
Do you want to increase the time in which the logout is an open forum page, right?
 

xmlxp

Active member
#8
what I meant from this post is the number of members and guests OnLine Now is limited by xenforo code to 60 minutes currently, what I want is increase it to 240 minutes for example to show more members and guests OnLine Now :)
 

Akinak

Well-known member
#11
what I meant from this post is the number of members and guests OnLine Now is limited by xenforo code to 60 minutes currently, what I want is increase it to 240 minutes for example to show more members and guests OnLine Now :)
OnlineNow show users by active session. When user close brouser or press logout or 60 min comes session is deleted. So, You can change this time (60 min) by editing code (or editing config.php).
 

truonglv

Formerly Nobita.Kun
#14
When visitor visiting your site, and clicked any link on your site, Its should be consider 'Online' and It recorded into xf_sesseation_activity. And xenForo called 'Online' by
PHP:
return $sessionModel->getSessionActivityQuickList(
            $visitor->toArray(),
            array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())),
            ($visitor['user_id'] ? $visitor->toArray() : null)
        );
So simple Addon should be overidden this function:
Code:
/**
    * Returns the length of time after the last recorded activity that a user is considered 'online'
    *
    * @return integer Time in seconds
    */
    public function getOnlineStatusTimeout()
    {
        return XenForo_Application::$time - XenForo_Application::get('options')->onlineStatusTimeout * 60;
    }
Or you can edit such as
Hello,

Enable debug mode :
Code:
$config['debug'] = true;
and edit "max value"
 

Akinak

Well-known member
#15
When visitor visiting your site, and clicked any link on your site, Its should be consider 'Online' and It recorded into xf_sesseation_activity. And xenForo called 'Online' by
PHP:
return $sessionModel->getSessionActivityQuickList(
            $visitor->toArray(),
            array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())),
            ($visitor['user_id'] ? $visitor->toArray() : null)
        );
So simple Addon should be overidden this function:
Code:
/**
    * Returns the length of time after the last recorded activity that a user is considered 'online'
    *
    * @return integer Time in seconds
    */
    public function getOnlineStatusTimeout()
    {
        return XenForo_Application::$time - XenForo_Application::get('options')->onlineStatusTimeout * 60;
    }
Or you can edit such as
Also look class XenForo_CronEntry_CleanUp
// delete expired session activities
$sessionModel = XenForo_Model::create('XenForo_Model_Session');
$sessionCleanUpCutOff = XenForo_Application::$time - 3600;
$sessionModel->updateUserLastActivityFromSessions();
$sessionModel->deleteSessionActivityOlderThanCutOff($sessionCleanUpCutOff);
this code delete old records from table session_activity.
 

xmlxp

Active member
#16
as I said its little bit complicated with 3 or 4 code elements involved and it needs a skilled coder to make this add-on and I am sure this add-on will make good sales for the coder
 
Last edited:

Akinak

Well-known member
#17
No big deal here.
The problem occurred in the understanding of what you want.
I decided that I need time to logout. And there was a block "Users Online"