Will Munny Posted February 26, 2015 Posted February 26, 2015 How do I change this? It appears to be set at 30 minutes. How to adjust this? I can't see anything in ACP.
Will Munny Posted February 27, 2015 Author Posted February 27, 2015 Is this a file edit? I'm happy to edit a file to make this happen. . .
Will Munny Posted February 27, 2015 Author Posted February 27, 2015 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?
Will Munny Posted February 27, 2015 Author Posted February 27, 2015 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?
Cyrem Posted February 27, 2015 Posted February 27, 2015 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.phpMake sure you edit times for both member and guest. Hopefully IPS will give this widget an option panel for this, probably just an oversight. AndyF 1
Will Munny Posted February 27, 2015 Author Posted February 27, 2015 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?
Cyrem Posted February 27, 2015 Posted February 27, 2015 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 ));
Will Munny Posted February 27, 2015 Author Posted February 27, 2015 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.
Andy Millne Posted February 27, 2015 Posted February 27, 2015 (edited) 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 February 27, 2015 by Andy Millne AndyF 1
Cyrem Posted February 27, 2015 Posted February 27, 2015 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 resultsAh yes, good point. Probably a good idea for an article as no doubt this question will come up several times.
Will Munny Posted February 27, 2015 Author Posted February 27, 2015 Maybe I'm being completely blind, I can't find the setting in the group settings? System --> Applications --> System --> Online User List Cyrem 1
Will Munny Posted February 28, 2015 Author Posted February 28, 2015 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 resultsIs this the session.gc_maxlifetime setting?
DesignzShop Posted February 28, 2015 Posted February 28, 2015 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...
Will Munny Posted April 13, 2015 Author Posted April 13, 2015 (edited) 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 April 13, 2015 by Will Munny
Stritix Posted May 9, 2016 Posted May 9, 2016 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. Lisa~ 1
Management Lindy Posted May 9, 2016 Management Posted May 9, 2016 5 hours ago, Stritix said: 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. Stritix, Rhett and Simon Woods 3
Stritix Posted May 9, 2016 Posted May 9, 2016 5 hours ago, Lindy said: 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.
Stritix Posted May 10, 2016 Posted May 10, 2016 3 minutes ago, chilihead said: You can edit the session timeout in PHP. Is there an up to date tutorial for this?
chilihead Posted May 10, 2016 Posted May 10, 2016 (edited) In php.ini it is session.gc_maxlifetime. Edited May 10, 2016 by chilihead AndyF 1
Stritix Posted May 10, 2016 Posted May 10, 2016 13 minutes ago, chilihead said: In php.ini it is session.gc_maxlifetime. Are there any dangers?
Management Lindy Posted May 10, 2016 Management Posted May 10, 2016 3 hours ago, Stritix said: 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. Simon Woods, Aiwa and Stritix 3
chilihead Posted May 10, 2016 Posted May 10, 2016 54 minutes ago, Stritix said: Are there any dangers? Take Lindy's advice. Simon Woods and AndyF 2
Stritix Posted May 10, 2016 Posted May 10, 2016 1 hour ago, Lindy said: 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?
Recommended Posts