Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: Cola-Coca - huhtikuu 21, 2020, 06:50:32 IP

Otsikko: Most Online Ever and Most Online Today does not work
Kirjoitti: Cola-Coca - huhtikuu 21, 2020, 06:50:32 IP
Hi,

I noticed that the statistics "Most Online Ever" and "Most Online Today" does not work.
For example, for "Most Online Today" I always have a number: 1768 and so every day. Does anyone know why I have this problem and how to fix it?

I leave my "BoardIndex.template.php" in attach.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: vbgamer45 - huhtikuu 21, 2020, 08:16:57 IP
Do you have a url? any mods installed?  How long has it been that way?
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Cola-Coca - huhtikuu 21, 2020, 10:01:08 IP
Lainaus käyttäjältä: vbgamer45 - huhtikuu 21, 2020, 08:16:57 IP
Do you have a url? any mods installed?  How long has it been that way?

For a long time, that's how it stands. I sent the link from the forum via PM message.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: drewactual - huhtikuu 21, 2020, 10:08:08 IP
Stats turned off?
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Cola-Coca - huhtikuu 22, 2020, 06:28:08 IP
Lainaus käyttäjältä: drewactual - huhtikuu 21, 2020, 10:08:08 IP
Stats turned off?

I don't know if it is Stats turned off. How can I see this?
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: drewactual - huhtikuu 22, 2020, 08:13:33 IP
admin>configuration>features and options

check the box for 'enable who is online' and 'track daily stats'...
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 22, 2020, 09:53:03 IP
The stats OP is referring to are unaffected by those settings.  Try Admin -> Forum Maintenance  -> Recount all forum totals and statistics.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: drewactual - huhtikuu 22, 2020, 10:11:05 IP
To track stats it has to be on. 
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 22, 2020, 10:55:30 IP
Hmm, looks like 'Enable who's online list' just adds link next to 'Users Online' to view detailed list.  'Track daily statistics' doesn't seem to change anything, but 'Most Online Today' and 'Most Online Ever' shouldn't be displayed if they're not being tracked.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 23, 2020, 04:32:16 IP
Doesn't look like that info is conditional on stats setting -



echo '
</p>
<p class="last smalltext">
', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
</p>';



It's displayed either way, so it should be tracking.

One odd thing, I'm not seeing the PM bar when logged in with stats disabled -



// If they are logged in, but statistical information is off... show a personal message bar.
if ($context['user']['is_logged'] && !$settings['show_stats_index'])



I know it works because I was asked to remove it on one forum, but not seeing it in test install.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: m4z - huhtikuu 23, 2020, 04:49:06 IP
Lainaus käyttäjältä: Sir Osis of Liver - huhtikuu 22, 2020, 10:55:30 IP
'Track daily statistics' doesn't seem to change anything, but 'Most Online Today' and 'Most Online Ever' shouldn't be displayed if they're not being tracked.

If the setting ever was enabled, when turning it off, the old values will not be cleared and/or hidden. Instead, the old values will be displayed forever. Which is exactly what drewactual was referring to.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 23, 2020, 04:55:26 IP
Doesn't make sense to keep displaying old values, seems simple enough to make it conditional on stats setting.  Wonder why it wasn't done that way?
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: m4z - huhtikuu 23, 2020, 05:05:49 IP
I don't know. It might be tracked as a 2.1 bug somewhere; don't know about 2.0.x tho.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 23, 2020, 05:10:27 IP
AFAIK it was never reported as a bug, but I believe it's come up in support several times.  Seems to be a simple thing to fix.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Cola-Coca - huhtikuu 24, 2020, 01:05:36 AP
Lainaus käyttäjältä: drewactual - huhtikuu 22, 2020, 08:13:33 IP
admin>configuration>features and options

check the box for 'enable who is online' and 'track daily stats'...

Thank you, my option was off. Now I turned it on and everything is working properly.
On the moment I turned off the option, the numbers remained from that moment, why? I don't know, maybe a bug.
My forum is on 2.0.15
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: vbgamer45 - huhtikuu 24, 2020, 01:08:33 AP
Glad you have it working! Simple fix.  I agree with that information being  not shown if the setting is disabled.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Cola-Coca - huhtikuu 24, 2020, 01:13:03 AP
Unfortunately, it shows numbers from the moment the option is off.

Thank you all for your help.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Kindred - huhtikuu 24, 2020, 09:37:43 AP
until the stats CHANGE, it's not going to update....
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 24, 2020, 12:30:21 IP
That's not the issue.  If stats are disabled, it continues to display the last numbers indefinitely.  Shouldn't be displayed at all until stats are re-enabled.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Kindred - huhtikuu 24, 2020, 12:31:47 IP
that's a SEPARATE issue....   now that the OP has turned Stats ON, they will not change until a different value is recorded.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 24, 2020, 12:35:29 IP
Lainaus käyttäjältä: Kindred - huhtikuu 24, 2020, 12:31:47 IP
that's a SEPARATE issue....   

Ok, yes.  But why hasn't this been fixed?
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Arantor - huhtikuu 24, 2020, 12:45:12 IP
Are we sure it's broken?
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Cola-Coca - huhtikuu 24, 2020, 06:44:12 IP
Lainaus käyttäjältä: Sir Osis of Liver - huhtikuu 24, 2020, 12:30:21 IP
That's not the issue.  If stats are disabled, it continues to display the last numbers indefinitely.  Shouldn't be displayed at all until stats are re-enabled.

If it's not a BUG then fine.
Anyway my stats are working now.  :)
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 24, 2020, 08:55:12 IP
Lainaus käyttäjältä: Arantor - huhtikuu 24, 2020, 12:45:12 IP
Are we sure it's broken?

Actually, no.  This is another one of those irritating little things that, for reasons unknown, was apparently done by design.  It doesn't make sense to display those stats if they're not being updated, they're meaningless, and it's a simple fix to hide them if stats are disabled.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Cola-Coca - huhtikuu 24, 2020, 11:28:08 IP
Lainaus käyttäjältä: Sir Osis of Liver - huhtikuu 24, 2020, 08:55:12 IP
Lainaus käyttäjältä: Arantor - huhtikuu 24, 2020, 12:45:12 IP
Are we sure it's broken?

Actually, no.  This is another one of those irritating little things that, for reasons unknown, was apparently done by design.  It doesn't make sense to display those stats if they're not being updated, they're meaningless, and it's a simple fix to hide them if stats are disabled.

I completely agree with you. If the statistics are off then SMF should not show Most Online Today: same number all days.

Regards.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: drewactual - huhtikuu 25, 2020, 12:49:02 AP
I could see it being beneficial for admin/owner/manager having access or visibility of stats, and while not showing them to everyone/anyone...

It 'could' be a simple mod with "is admin" type conditional.  Presumably, it would free up some resources too, except for the admin.  I say that not knowing how hungry that function (stats) is. 

As it is: Changing the template is easy enough, or adding a conditional... hiding with css can work, and if done with a html comment tag, would still be visible to anyone going through the trouble of viewing source... of these numbers are something an admin is concerned about it but doesn't feel need to shout about ..

There is a bunch of directions to go if its that great a concern. I agree that if its "off" then it likely shouldn't be shown... but that is yet another server call and yet another millisecond or so (being goofy.... somewhat)... so.... carve it out of the template and source code if it isn't being used... AND you don't anticipate using it. 

Thing is, though, a lot of forum users are used to seeing these kinds of things shared.. not all, but some users... let's say 25%... so when they don't see it they may get a wrong impression?  Or... maybe not... point is: it isn't a big deal one way or another..
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 26, 2020, 06:21:10 IP
  >:( Why doesn't this work?



if ($settings['show_stats_index'])
echo '
</p>
<p class="last smalltext">
', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
</p>';


Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: drewactual - huhtikuu 26, 2020, 06:49:16 IP
Slap an elseif after it void of the text calls and it should?
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 26, 2020, 06:50:46 IP
Thought of that but didn't try it, shouldn't be necessary should it?  I'll have a look.

Nope, that's not it.  It either shows it or doesn't show it, regardless of setting.  Maybe it's linked to another setting.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Arantor - huhtikuu 26, 2020, 07:00:20 IP
Which setting do you think you've connected it to? So far you've connected it to a theme setting about showing the stats, not the $modSettings entry to disable it.
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 26, 2020, 07:09:56 IP
Well, yes, I'm using $settings['show_stats_index'] to try to remove it when Track daily statistics is disabled.  But it either removes it from the theme or displays it with either option checked, so it's the wrong setting.  Looks like the correct setting in db is trackStats, but that apparently isn't $settings['show_stats_index'].


Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Arantor - huhtikuu 26, 2020, 07:20:34 IP
No, it isn't. It's $modSettings['trackStats'].
Otsikko: Re: Most Online Ever and Most Online Today does not work
Kirjoitti: Sir Osis of Liver - huhtikuu 26, 2020, 07:23:27 IP
Yep, just got it -



if ($modSettings['trackStats'])
echo '
</p>
<p class="last smalltext">
', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
</p>';



Thanks.

So it is simple to fix, that was my point.