MyBB Community Forums

Full Version: Remove guests from the "Who's Online" page /online.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey guys, I noticed the support board is kind of slow so I decided to ask this question because I've been trying for days to get this figured out, as simple as it is I can't figure it out,

I need to keep guests from showing up on the "Who's Online" -- www.yoursite.com/online.php
in other words, I need to remove guests from who's online" /online.php

I have a few little twerks to work out, and this is one of them,
any help or point in the right direction would be immensely appreciated
thanks so much!
In online.php

Find:
$query = $db->simple_select("sessions", "COUNT(sid) as online", "time > {$timesearch}");

Replace:
$query = $db->simple_select("sessions", "COUNT(sid) as online", "time > {$timesearch} AND uid != 0");

Find:
// Query for active sessions
	$query = $db->query("
		SELECT DISTINCT s.sid, s.ip, s.uid, s.time, s.location, u.username, s.nopermission, u.invisible, u.usergroup, u.displaygroup
		FROM ".TABLE_PREFIX."sessions s
		LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
		WHERE s.time>'$timesearch'
		ORDER BY $sql
		LIMIT {$start}, {$perpage}
	");

Replace:
// Query for active sessions
	$query = $db->query("
		SELECT DISTINCT s.sid, s.ip, s.uid, s.time, s.location, u.username, s.nopermission, u.invisible, u.usergroup, u.displaygroup
		FROM ".TABLE_PREFIX."sessions s
		LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
		WHERE s.time>'$timesearch' AND s.uid != 0
		ORDER BY $sql
		LIMIT {$start}, {$perpage}
	");
@dragonexpert isnt it enough to comment out/remove the if block for the guests, where the actual table is built, like this... am i doing it wrong.... guests will be counted but just not displayed...

// Now we build the actual online rows - we do this separately because we need to query all of the specific activity and location information
	$online_rows = '';
	if(isset($users) && is_array($users))
	{
		reset($users);
		foreach($users as $user)
		{
			$online_rows .= build_wol_row($user);
		}
	}
	/** if(isset($guests) && is_array($guests))
	{
		reset($guests);
		foreach($guests as $user)
		{
			$online_rows .= build_wol_row($user);
		}
	} **/
Or you can do like i did. if you wanna come on my online.php list, you need to make a post. This allows me to allow google as a user, but it would still not be shown (maybe for future use, and be careful if you touch with bot settings.)

Open /index.php and find:
WHERE s.time>'$timesearch'
replace it with:
WHERE s.time>'$timesearch' AND u.usergroup != '7'
The reason I altered there where clause because
1) Pagination could be wrong if you don't.
2) It fetches only the rows necessary so it will execute faster.
@dragonexpert valid point, agreed.. Thanks for the clarification though...
I love you guys, everyone of you are so helpful and kind, I appreciate all the help and time you all gave me assisting the solution, works great,

and just to show you why it was so important for me to remove guests, because I reformatted the "Who's Online" to a vertical layout, so removing guests was the first step, below is a pic of the results so far,

This is what I have so far,
[Image: 1onlin.png]

*Note:for the curious, the number of Who's  Online, that is just mock up, to show as an exmaple and not really how many people were online.

I think I may need to hire an expert for an hour because I think I'm going to have issues  
creating rows like this
This is what I'm trying to achieve.
[Image: default2.png]
If talking about the amount https://github.com/mybb/mybb/blob/featur...ne.php#L52
https://github.com/mybb/mybb/blob/featur...e.php#L183

If the design as I'm guessing you've made the mock in ps I can probably spoonfeed you it if u want.
(2014-10-30, 04:06 AM)Rakes Wrote: [ -> ]If talking about the amount https://github.com/mybb/mybb/blob/featur...ne.php#L52
https://github.com/mybb/mybb/blob/featur...e.php#L183

If the design as I'm guessing you've made the mock in ps I can probably spoonfeed you it if u want.

Hi rakes, thank you bro, I appreciate the pointer, and ha ha, only the Number of users online is photoshopped in,
the actual people online is true

The issue is, how do I make multiple rows, as in the pic above that shows multiple rows of people online?
This is the last glitch on my site I can't seem to figure out,
it is compicated so I need to logg in like ten accounts to look at it

Note: I'm not going to bug the team about this, this is something I will need to pay a developer, maybe one of the team members here, to help me figure out.
Um, hey, you guys know, this solution is outdated for 1.8.22, wuzzz wondering, is there a new solution to simply remove "Guest" word from showing on who's online, no big deal.
Pages: 1 2