News:

Wondering if this will always be free?  See why free is better.

Main Menu

# of people viewing topic not working properly

Started by Malibuz0r, February 20, 2013, 05:21:46 PM

Previous topic - Next topic

Malibuz0r

So I had around 6 people visit a topic to test it out, but it only showed "my_nick (the user viewing the topic) and 0 guests viewing the topic". Guests aren't allowed to view forum so that 0 its fine, however it doesn't show the other people viewing the board.

Here's the code that I have not modified at all:

if (!empty($settings['display_who_viewing']))
{
echo '
<p id="whoisviewing" class="smalltext">';

// Show just numbers...?
if ($settings['display_who_viewing'] == 1)
echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
// Or show the actual people viewing the topic?
else
echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');

// Now show how many guests are here too.
echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
</p>';
}

I'm not sure how the actual counting is done, but that ^ only displays the data doesn't it?

Arantor

Were they actually all viewing it at the exact same time and were they all logged in?

Malibuz0r

Yes and yes. I'm also using latest version of SMF if that helps..

Arantor

What are you calling the 'latest version'? That could be two completely different things.

Malibuz0r

Version Information:
Forum version: SMF 2.0.4
Current SMF version: SMF 2.0.4

Arantor

That's good. (In case you're wondering why I'm asking, 1.1.18 and 2.0.4 are both the latest versions and they came out on the same day.)

OK, next thing, is Admin > Configuration > Features and Options > Enable who's online list ticked?

Malibuz0r

Yes it is. Also "User online time threshold" = 15

Arantor

Then there's no actual reason for it not to work unless you have some mods that have damaged something in the online handler.

Malibuz0r

I've only installed 4 mods so far:

1.   SMF 2.0.4 Update   1.0
2.   Aeva ~ Auto-Embed Video & Audio   7.2
3.   SMF 2.0.3 Update   1.0
4.   Stop Forum Spam   1.0

and SimplePortal which is not shown on the installed packages list.

Shambles

In your Theme Options & Preferences, what do you have set for "Show who is viewing the board index and posts:"

Malibuz0r


emanuele

In my testings there is a combination when the info is not updated.

user 1: enters topic
user 2: enters topic
user 1: refreshes the page
user 1 still see only himself in the topic, while user 2 sees both.

Not sure if this is the case.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Arantor

Thinking about it, that's probably what happened. The online log isn't updated every page view for performance reasons, especially if it's within a few seconds of the last one, so I can totally see that happening here. Doubly so under 'test' conditions where you're trying to reproduce it.

Only fix is to really hurt performance by updating it every time regardless, causing massive thrash of the log_online table. Conclusion: won't fix.

Advertisement: