MyBB Community Forums

Full Version: [F] Who's online counter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

I noticed that Who's online counter is performing the following calculation:

Members + Invisibles + Guests + Bots

I think it should be:

Members + Guests + Bots

since all the Invisibles are Members as well.

I'm using 1.4.4.
So say there were 5 members online, and 2 were invisible, it would say 7 are online?? Just so make sure I'm understanding.
Take a look at how it works... $onlinecount is the total amount of people online (index.php):

	// Build the who's online bit on the index page.
	$onlinecount = $membercount + $guestcount + $botcount;
	
	// If we can see invisible users add them to the count
	if($mybb->usergroup['canviewwolinvis'] == 1)
	{
		$onlinecount += $anoncount;
	}
	
	// If we can't see invisible users but the user is an invisible user incriment the count by one
	if($mybb->usergroup['canviewwolinvis'] != 1 && $mybb->user['invisible'] == 1)
	{
		++$onlinecount;
	}

Basically, it's members + guests + bots, then if you're able to see invisibles, that is added too. Although, I can't reproduce anything from tests on a new 1.4.4 install - which plugins do you have?

Also, see: Whos online bug/ISSUE?? MYBB 1.4.4
the code is fine. invisible users get in the count, but if the forum detects them as invisible then their total value goes back to 0 again.
Add me as having the same problem..

Posted in this thread with pic----->http://community.mybboard.net/thread-42003.html
(2008-12-16, 10:16 AM)MattR Wrote: [ -> ]So say there were 5 members online, and 2 were invisible, it would say 7 are online?? Just so make sure I'm understanding.

Exactly

(2008-12-16, 10:26 AM)Tom.M Wrote: [ -> ]Take a look at how it works...

Thanks for showing the code.

(2008-12-16, 10:26 AM)Tom.M Wrote: [ -> ]Basically, it's members + guests + bots, then if you're able to see invisibles, that is added too.

Well, I guess that is an undesired behavior (a.k.a bug). As I can see, $anoncount is part of $membercount, so you're adding more users than they really are. Example: "5 members, 2 of whom are invisible" means that the 2 invisibles, are part of the total of 5 members. So, the total online here must be 5, not 7, just as this guy is showing in this thread.
I would consider that a bug then, if it can be reproduced. As you said, it shouldn't add visible users to invisible users, it should count how many are online, regardless of visibility, and then give the invisible count next to it.
I see the problem here. Let's say their are 5 members online, 2 Invisible, and 2 Guests. It will count the total of 9. However, even as an admin or mod who can see the invisible users, their are only 5 or a 7 total including guests. Its basically double counting. I'm going to do some further tests on this however, to make sure it's actually reproduceable.
Well if it's overcounting the invisibles that's easy to fix by just not including them in the total.
You guys aren't adding in the # of bots online.
Pages: 1 2