Jump to content
This topic contains 31 posts with an estimated read time of 24 minutes. A summary containing the most significant posts is available with an estimated read time of 3 minutes.

Featured Replies

Posted

How do I change this? It appears to be set at 30 minutes. How to adjust this? I can't see anything in ACP.

  • Author

Is this a file edit? I'm happy to edit a file to make this happen. . .

  • Author

I think I figured this out myself. In /applications/core/modules/front/online. . .

        /* Initial filters */
        $where = array(
            array( "core_sessions.running_time>?", \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ),

If I change the 'PT30M' to something like 'PT15M' or 'PT90M', it appears to work. Is this a safe edit?

  • Author

Actually it seems you also have to edit the following line to make it work. . .

		$table->limit = 30;

That also makes the online users page much bigger or smaller though (depending on which way you edit the limit). I actually prefer to see bigges online users pages.

Any devs got some input for this?

 

Actually it seems you also have to edit the following line to make it work. . .

		$table->limit = 30;

That also makes the online users page much bigger or smaller though (depending on which way you edit the limit). I actually prefer to see bigges online users pages.

Any devs got some input for this?

​Um no thats the SQL result limit and you're actually cutting the amount of results in the query. You probably shouldn't touch that.

Pretty sure you should be modifying the widget not the online module. File: core\widget\whosOnline.php

Make sure you edit times for both member and guest. Hopefully IPS will give this widget an option panel for this, probably just an oversight.

  • Author

Yes you're right, thanks for the pointer. There were two references to the 30 minute limit in that file you mentioned and changing them both (one for members, one for guests) appears to work. . .

        /* Get Members */
        $members = iterator_to_array( \IPS\Db::i()->select( array( 'member_id', 'member_name', 'seo_name', 'member_group' ), 'core_sessions', array(
            array( 'login_type=' . \IPS\Session\Front::LOGIN_TYPE_MEMBER ),
            array( 'running_time>' . \IPS\DateTime::create()->sub( new \DateInterval( 'PT90M' ) )->getTimeStamp() )
        ), 'running_time DESC', $this->orientation === 'horizontal' ? NULL : 60 )->setKeyField( 'member_id' ) );
        
        /* Get guests count */
        $memberCount = 0;
        $guests = 0;
        $anonymous = 0;
        if ( $this->orientation === 'horizontal' )
        {
            foreach ( \IPS\Db::i()->select( 'login_type, COUNT(*) AS count', 'core_sessions', array( 'running_time>' . \IPS\DateTime::create()->sub( new \DateInterval( 'PT90M' ) )->getTimeStamp() ), NULL, NULL, 'login_type' ) as $row )

Safe???

Also, There appears to be no setting to make this box only available to members. Do you have any advice for me on how to hide it from guests?

 

 

Safe???

Also, There appears to be no setting to make this box only available to members. Do you have any advice for me on how to hide it from guests?

​Yes that should be safe, it doesn't modify the database if thats what you mean.

Regarding group visibility, at the end of that file you'll see /* Display */ Return, replace that with:

/* Display */
$visibleToGroups = array(2,4); // 2 = Guest, 4 = Default Admin group
return (in_array(\IPS\Member::loggedIn()->member_group_id,$visibleToGroups) ? $this->output( $members, $memberCount, $guests, $anonymous ) : '');

Add more group id's to that $visibleToGroups array.

 

EDIT:

You could do the opposite way if it's more suitable so you don't have to edit for new groups.

/* Display */
$hideForGroups = array(2); // 2 = Guest
return (in_array(\IPS\Member::loggedIn()->member_group_id,$hideForGroups) ? '' : $this->output( $members, $memberCount, $guests, $anonymous ));

 

  • Author

Thanks. That gave me a white screen unfortunately. However, I've now realised there's a group permissions setting in ACP to hide the online users from specific groups altogether.

If altering this you would need to also make sure PHP is configured so that the session expiration time is at least as high as the value you set or you'll see varying results when garbage collection runs. that is one of the reasons it is no longer configurable as increasing the value does not necessarily lead to reliable results

Edited by Andy Millne

 

 However, I've now realised there's a group permissions setting in ACP to hide the online users from specific groups altogether.

Maybe I'm being completely blind, I can't find the setting in the group settings?

 

If altering this you would need to also make sure PHP is configured so that the session expiration time is at least as high as the value you set or you'll see varying results when garbage collection runs. that is one of the reasons it is no longer configurable as increasing the value does not necessarily lead to reliable results

​Ah yes, good point. Probably a good idea for an article as no doubt this question will come up several times.

  • Author
 

Maybe I'm being completely blind, I can't find the setting in the group settings?

​System --> Applications --> System --> Online User List ;)

  • Author
 

If altering this you would need to also make sure PHP is configured so that the session expiration time is at least as high as the value you set or you'll see varying results when garbage collection runs. that is one of the reasons it is no longer configurable as increasing the value does not necessarily lead to reliable results

Is this the session.gc_maxlifetime setting?

 

​Hopefully IPS will give this widget an option panel for this, probably just an oversight.

​I sure hope so. This is one feature I used for sure and set to 60 minutes instead of 5 or whatever it is. Every site I visited used a different time here it seemed. Kiss it goodbye I guess. Wow...

  • 1 month later...
  • Author

This appears to have changed in the latest version. There now appears to be only one place to make the edit. The 'PT30M'. Is this a safe edit, are there any gotchas I may have missed?. . .

/applications/core/widgets. . .

		/* Do we have permission? */
		if ( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'online' ) ) )
		{
			return "";
		}

		$where = array(
			array( 'core_sessions.running_time>' . \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ),
			array( 'core_groups.g_hide_online_list=0' )
		);

 

Edited by Will Munny

  • 1 year later...

Why is there no setting to change this? Basic functions from IPB3 are missing in IPS4. I just upgraded to IPS4. I'd rather not modify files. Please let us change the cut off time.

  • Management
 

Why is there no setting to change this? Basic functions from IPB3 are missing in IPS4. I just upgraded to IPS4. I'd rather not modify files. Please let us change the cut off time.

Because IPS4 uses PHP sessions and the default garbage collection is 30 minutes. Editing PHP configurations is beyond most users and and it's really not necessary - if you want to make your site look more busy than it actually is, there's plugins in the marketplace to replace the online user block. You should ideally leave the stock settings alone. 

 

Because IPS4 uses PHP sessions and the default garbage collection is 30 minutes. Editing PHP configurations is beyond most users and and it's really not necessary - if you want to make your site look more busy than it actually is, there's plugins in the marketplace to replace the online user block. You should ideally leave the stock settings alone. 

I don't really like using plugins. They aren't often reliable. Is there a way to simply edit a file to change this setting? It seems that the past method is now outdated.

You can edit the session timeout in PHP.

 

You can edit the session timeout in PHP.

Is there an up to date tutorial for this?

In php.ini it is session.gc_maxlifetime.

Edited by chilihead

 

In php.ini it is session.gc_maxlifetime.

Are there any dangers?

  • Management
 

I don't really like using plugins. They aren't often reliable. Is there a way to simply edit a file to change this setting? It seems that the past method is now outdated.

I can nearly guarantee a plugin that simply selects from the user table to determine who has been active in the past X hours to manipulate the list is going to be more reliable than hacking code, changing server configs, etc. ^_^ I'm not sure you understand what you're actually doing here - you're not setting a display cutoff, you're altering the PHP garbage collection config. 

We've had issues with people tinkering with this and I feel compelled to note, you're "voiding your warranty" so-to-speak and we will not provide tech support should you end up with "people aren't staying logged in" etc. Proceed at your own risk. 

 

I can nearly guarantee a plugin that simply selects from the user table to determine who has been active in the past X hours to manipulate the list is going to be more reliable than hacking code, changing server configs, etc. ^_^ I'm not sure you understand what you're actually doing here - you're not setting a display cutoff, you're altering the PHP garbage collection config. 

We've had issues with people tinkering with this and I feel compelled to note, you're "voiding your warranty" so-to-speak and we will not provide tech support should you end up with "people aren't staying logged in" etc. Proceed at your own risk. 

I will not be altering anything if that's the case. What plugin do you recommend?

Recently Browsing 0

  • No registered users viewing this page.