MyBB Community Forums

Full Version: Where can I find the code for users online time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i don''t mean the variable, but the code that holds the query needed to calculate the time spent online for users. or can someone post here the whole query?
The column is called 'timeonline' in the users table.

$myuid = intval( $mybb->user['uid'] );
$query = $db->query(" SELECT timeonline FROM ".TABLE_PREFIX."users WHERE uid='$myuid' ");

Remember to fetch it.
(2016-02-10, 03:48 PM)Sazze Wrote: [ -> ]The column is called 'timeonline' in the users table.

i know that. i want to know in which php file the query can be found that calculates the time that users have spent online. Or if someone can post the query here would be great.
(2016-02-10, 03:51 PM)tarekovski Wrote: [ -> ]
(2016-02-10, 03:48 PM)Sazze Wrote: [ -> ]The column is called 'timeonline' in the users table.

i know that. i want to know in which php file the query can be found that calculates the time that users have spent online. Or if someone can post the query here would be great.

Check the stats file you will find a handful of queries in there you can replicate.
I don''t see the query for what i asked in the stats file
(2016-02-10, 04:08 PM)tarekovski Wrote: [ -> ]I don''t see the query for what i asked in the stats file

My apologies I assumed it was there. In that case I would use the code Sazze provided in the file you need or make a plugin and use the relevant hooks with the code inside a function.
https://github.com/mybb/mybb/blob/featur...2366-L2370
		$timeonline = $lang->none_registered;
		if($memprofile['timeonline'] > 0)
		{
			$timeonline = nice_time($memprofile['timeonline']);
		}
+ the field selection with a query like the one above or jsut a simple_select().