Who Has Visited In Last 24 Hours [Paid] [Deleted]

This is a great addon, and thanks for writing it.

I think that the "Enable Record Online Members" has a great deal of potential and I was very excited to turn it on. Looking at the maximum number of people online at one time is a very intuitive way for community members to measure the growth of a community using data that they already have at hand. If they can monitor when a new record is set, it can help them bond with the community (I know that this is true because I monitor the number fairly obsessively).

To realize this potential, I think that the software has to record separate records for both admins and non-admins. It doesn't appear to do this right now. For example, on my forum, right now, this is how it looks to admins and non-admins, respectively:
upload_2014-12-23_19-49-13.webpupload_2014-12-23_19-49-23.webp

By looking at the admin's view, I can see that we are very close to setting a new record. However, by looking at the non-admin's view, it looks like we aren't even close. Rather than encouraging people by showing them that we are growing, it will look like we aren't doing as well as we are. This feels like a real downer to this admin, as I want to get people to be very proud of the community. Therefore, I'm turning the feature off.

Am I misinterpreting things? Any chance of keeping separate "records" for the admins and the non-admins?
 
Why would you want to show a lower number to users than it actually is? I don't see a reason to keep two records for it. I think you are over thinking this a bit as far as how members look at this add-on.
 
The goal would be to make it consistent, so that non-admins will know how close we are to our record-setting number of visitors.

Perhaps I haven't explained what I was trying to say very well. The numbers at the bottom of the list, shown to non-admins, feel inconsistent to me in that the "currently" number does not include banned people or people whose status is hidden, whereas the "Record" number does.

For example, the two screenshots shown in my last post were taken at the same time. The one of the left was as seen by an administrator and the one on the right by a non-admin. From the screenshot on the right, you can see that the forum just broke a record for total online visitors. However, regular members would have no idea of that because the "Currently" and "Record" numbers are calculated inconsistently for non-admins.
Why would you want to show a lower number to users than it actually is?
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.

I can see two ways of making the view consistent for the non-admins. From the above screenshots, I would guess that the record number of people ever having been online is 83, if hidden and banned people are excluded. Assuming you tracked this second record (the one that excludes hidden and banned members), the way of making the view consistent for non-admins would be to show them:
Currently: 82 Members (Last 48 Hours)
Record: 83 Members​
Alternatively, a second way to make it consistent would be to make all totals always reflect hidden and banned members, like so:
Currently: 108 Members (Last 48 Hours)
Record: 109 Members​
The non-admins would only be able to see the usernames of 82 of the members, (the ones who aren't hidden or banned) but they would know that 108 members had been on recently.

Either of the two ways for making it consistent would work very well for me. Hopefully, it wouldn't require many lines of code at all to implement the second version.

The only version that I don't like is the current version, which I find to be misleading because it is inconsistent:
Currently: 82 Members (Last 48 Hours)
Record: 109 Members​
The current version makes it look like we didn't just break a record, when, in fact, we had. It paints an unnecessarily pessimistic view of how the forum is doing. I want my forum to look strong, like it is growing, because it in fact it is.

I'd love to have the view updated using either of the suggestions above. To help explain why I feel the way I do, I've tried to use somewhat forceful and assertive language. I hope that hasn't offended, but I figured that if you're going to read what I wrote, it should at least be clear.

Finally, would it be possible to implement the second version via a simple template edit? I might not be able to convince you to see things my way, but if I can make the change myself, we all win. It seems like copying some template code from the version for admins to the version for non-admins might be a quick way to implement my second suggestion.
 
However, regular members would have no idea of that because the "Currently" and "Record" numbers are calculated inconsistently for non-admins.

I understand what you are asking but out of every forum I have ever run and managed, not one time has a member ever mentioned or seemed to care that the record of online members seemed "to far off". 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.

This seems more like a feature request for XenForo than for this add-on. The add-on simply adheres to the method that XenForo uses, which is to show banned and not valid members to admins and not to those without admin privileges.

Your second method would require that things change within XenForo, if I have read it correctly.
 
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?
 
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'll look at the code and see what I can come up with when I get some time. I haven't had the most time in the world over the last month and the holidays aren't helping. After the new year, ping me again to see where I am.

You are more than welcome to modify it or have someone else modify it if you wish. If you want to share, I would include it possibly, depending on the extent of the modifications. I just don't want to over complicate this add-on as it is pretty straight forward and works exactly how I want it. The idea is to keep it simple and so far you are the only one that has brought this up. Hope you understand my view point.
 
I absolutely understand your viewpoint. Thanks for taking the time to understand our needs and for being willing to take a look. I know how it feels to be busy. :/
 
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 am the one who suggested this to you and was going to touch base with you again about it. Good to hear you're still planning to include.
 
You are more than welcome to modify it or have someone else modify it if you wish.
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.)

I figured that what people really want to know is the total number of "real" members online. This should include non-visible members, but not people who have been banned (mostly spammers for us). Therefore, I had it count all members except those for which !$user['is_banned'] evaluated to true.

The relevant code was:
PHP:
    $fftwhv_count = 0;
     foreach ($whoHasVisited['users'] AS $key => &$user)
     {
       if (!$user['is_banned'])
         {
           $fftwhv_count++;
         }         
     }
     $whoHasVisited['count'] = $fftwhv_count;

The resulting method, found in library\WhoHasVisited\Model, is:
PHP:
    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;
    }
I'd be thrilled if you wanted to include it, @BamaStangGuy, as it would make upgrading much easier for me. Of course, it's your product, though. :)

If anyone else wants to install it in the meantime, I'm attaching a modified version of WhoVisited.php. It goes in
library\WhoHasVisited\Model . I've got it running in production on my own forum, but can't make any guarantees for anyone else, so use it at your own risk!
 

Attachments

Finally, if you want to reset your "Record" number because it was calculated using the old method and is too high (we've banned a lot of spammers recently, for example), I was able to reset it by temporarily pasting the following lines before the return statement in the prepareWhoHasVisited method. I don't know if it will work for others, though and can't provide support on how to do this.
PHP:
                $whoHasVisited['most_online_24'] = $whoHasVisited['count'];

                XenForo_Model::create('XenForo_Model_DataRegistry')->set('mostOnline24', $whoHasVisited['most_online_24']);
 
How do I get this to work with the widget framework?

I've created a widget that uses the 'who has visited' renderer, given it a title, a position and is active, but it's not appearing. Whereas all my other widgets seem to appearing just fine.

Is that the right way to do it?
 
If it makes any difference I did used to have the Xen TR one installed, but I've uninstalled it as one user kept causing server errors for some reason. So I bough this version.
 
Apologies, all sorted. I thought that if no user groups were selected it would automatically apply to all of them. Working like a charm now :)
 
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?
 
Do you have permission to see it?
Check in the ACP.
I'm new at this... I skimmed though the user group permissions... didn't see anything.

Can you please tell me where they are located for the [bd] widget framework and that widget specifically?
 
Top Bottom