Conversely, if there were 108 people online when the two screenshots were taken, above, why would you show a lower number than what it is under the "Currently" field for the non-admins? That appears to be what is happening in the screenshots above.Why would you want to show a lower number to users than it actually is?
However, regular members would have no idea of that because the "Currently" and "Record" numbers are calculated inconsistently for non-admins.
Hello,
Do you have find/understand the issue with last activity sorting ?
Thanks for taking the time to read through my long posts!
So does this mean that it is a security thing built in to XenForo, where when you are generating a page for a non-admin even an addon writer can't calculate the larger (including banned and not valid) number of current visitors? Because if that number could be calculated then couldn't it theoretically be inserted as the "Currently" number for the non-admins?
I am still planning to include a date when the record was achieved, so this might be a good compromise, to show that the record was achieved recently.
I decided to take a look at the code and came up with a solution that we are running on our site (to find it, Google [tms forum]). I love it! "Total counts" are calculated the same independent of a user's "canBypassUserPrivacy" setting. As a result, it solves the concern that I was describing above. (What was happening was that whenever an admin viewed the forum page, it boosted the "most_online_24" value up to the total number of users seen by the admin.)You are more than welcome to modify it or have someone else modify it if you wish.
$fftwhv_count = 0;
foreach ($whoHasVisited['users'] AS $key => &$user)
{
if (!$user['is_banned'])
{
$fftwhv_count++;
}
}
$whoHasVisited['count'] = $fftwhv_count;
public function prepareWhoHasVisited(array $whoHasVisited)
{
$fftwhv_count = 0;
foreach ($whoHasVisited['users'] AS $key => &$user)
{
if (!$user['is_banned'])
{
$fftwhv_count++;
}
if (!$this->getModelFromCache('XenForo_Model_User')->canBypassUserPrivacy())
{
if (!$user['visible'])
{
unset($whoHasVisited['users'][$key]);
}
if ($user['is_banned'])
{
unset($whoHasVisited['users'][$key]);
}
}
}
$options = XenForo_Application::get('options');
$whoHasVisited['count'] = $fftwhv_count;
$whoHasVisited['display_users'] = array_slice($whoHasVisited['users'], 0, $options->whoHasVisitedLimit, true);
$whoHasVisited['display_count'] = count($whoHasVisited['display_users']);
$whoHasVisited['hide_users'] = array_slice($whoHasVisited['users'], $options->whoHasVisitedLimit, NULL, true);
$whoHasVisited['hide_count'] = count($whoHasVisited['hide_users']);
if ($options->whoHasVisited24MostOnline)
{
$whoHasVisited['most_online_24'] = XenForo_Model::create('XenForo_Model_DataRegistry')->get('mostOnline24');
if ($whoHasVisited['most_online_24'] < $whoHasVisited['count'])
{
$whoHasVisited['most_online_24'] = $whoHasVisited['count'];
XenForo_Model::create('XenForo_Model_DataRegistry')->set('mostOnline24', $whoHasVisited['most_online_24']);
}
}
return $whoHasVisited;
}
$whoHasVisited['most_online_24'] = $whoHasVisited['count'];
XenForo_Model::create('XenForo_Model_DataRegistry')->set('mostOnline24', $whoHasVisited['most_online_24']);
Do you have permission to see it?Okay, I have uploaded the files, added the add on, rendered it using BD Framework... and I see nothing on my forum? :S Am I missing something?
I'm new at this... I skimmed though the user group permissions... didn't see anything.Do you have permission to see it?
Check in the ACP.
We use essential cookies to make this site work, and optional cookies to enhance your experience.