XF 2.0 Remove Guests from Members Online

hovik

Member
Hi, I'd like to hide/remove 'guests' from Members Online so they don't count in Total online or show up in Current visitors listing. The site is private with registration turned off, guests only see log-in page, but yet they still show up in both of those places and it confuses registered members. Thanks!
 
Hi, I'd like to hide/remove 'guests' from Members Online so they don't count in Total online or show up in Current visitors listing. The site is private with registration turned off, guests only see log-in page, but yet they still show up in both of those places and it confuses registered members. Thanks!
There is a way to do it by editing src/XF/Repository/SessionActivity.php. Unfortunately, I can't tell you offhand what exact line to edit how, since I did it a long time ago and I've just been copying over the contents of my edited file when needed ever since. Maybe when I have the time I can do a comparison between it and the default file to be sure, if no one else deigns to put you out of your misery in the meantime. Just be aware, though, that going that route generates an error on file health check, if you're a person who can't live with that. Andy's addon works, but last I tried it it displayed ALL members online, which is an ungainly list if you have a lot of users logged on. Can maybe be edited with CSS...? However, I've also edited the default time to show members online, so that might not be a problem for you if you're keeping those defaults.
 
@hovik, let me know if you run into any issues.

Navigate to and change phrase text from online_now_x_members_y_guests_z

to

Total Online: {members}

Here's what it should look like:

View attachment 193099
It removed the phrase guests, but now it makes even less sense since math doesn't add up lol Thank you though!

It also didn't remove guests from Current Visitors,
 

Attachments

  • screenshot.webp
    screenshot.webp
    4.6 KB · Views: 15
@hovik , sorry. I completely overlooked the fact that I don't allow guests on mine lol. I guess it wouldn't work on yours afterall.

If anybody sees this in the future, the technique I posted above will work if you don't allow guests. If you allow guests, it will not turn out correctly.
 
It removed the phrase guests, but now it makes even less sense since math doesn't add up lol Thank you though!

It also didn't remove guests from Current Visitors,
go to templates and open template widget_members_online

scroll down to end

find last lines
<div class="block-footer">
<span class="block-footer-counter">{{ phrase('online_now_x_members_y_guests_z',{
'total': number($online.counts.total),
'members': number($online.counts.members),
'guests': number($online.counts.guests)})

in this line 'total': number($online.counts.total),

change counts.total to counts.member

thats it, it will make total count of members only
 
go to templates and open template widget_members_online

scroll down to end

find last lines
<div class="block-footer">
<span class="block-footer-counter">{{ phrase('online_now_x_members_y_guests_z',{
'total': number($online.counts.total),
'members': number($online.counts.members),
'guests': number($online.counts.guests)})

in this line 'total': number($online.counts.total),

change counts.total to counts.member

thats it, it will make total count of members only
Nice, that worked, thanks!

Now if I could only remove guests from showing up in Current Visitors it would be perfect !
 
I'm guessing this is the template (online_list) that would control guests showing up in current visitors? Any ideas which lines to delete, if that's an option ...

I ended up deleting the total number all together from widget-members-online, just shows the names of the users online without calculating a total, it's clean, I like it. Now just need to remove those annoying guests from current visitors ...
 
I'm looking to stop guests showing up in the logs and current visitors. Our forum is only accessible to registered members so all those robots are irritation & distraction. Can anyone help with how to do this please?
 
Top Bottom