Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

July 02, 2022, 05:37:33 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 193409
  • Total Topics: 21081
  • Online today: 67
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 36
Total: 36

Author Topic: How to blank out number of guests online  (Read 695 times)

0 Members and 1 Guest are viewing this topic.

Offline North East Man

  • Jr. Member
  • **
  • Posts: 13
How to blank out number of guests online
« on: January 29, 2022, 05:00:44 AM »

Link to my forum: https:test.way-up.co.uk
SMF version: 2.0.19
TP version: 2.1.0
Default Forum Language: English
Theme name and version: Temiz
Browser Name and Version:
Mods installed:
Related Error messages: None


On my live forum I have the Tiny Portal Online box activated which shows the number of guests and users online.  The forum does not allow guest access, however, there are almost always "guests" shown in the who's online box.  I suppose these are members who have previously logged in looked around and logged out.  I have a 15 minute activity threshold set in the forum, so again I'm guessing that these "Guests" are people who were active in the last 15 minutes.

I am sick of new members messaging me and saying that they thought the forum was private and who are these guests.  Every time, I have to explain that there are no guests, etc, etc.

Is there a way to just have the online box just not show how many guests there are?

I think I have tracked it down to the code module "onlinebox.blockcode" module which in turn returns info from the function ssi_logOnline in SSI.php, but Subs-Membersonline.php appears to be involved as well.

I commented out the echo comment in my theme's Boardindex.template whic output the guests info but that made no difference.

I don't want to alter any core code, but I would just like the box to say how many members are online with no mention of the non existant guests.  In effect to just blank out and not show guest info.

Is this do-able?

Offline tino

  • Developer
  • *
  • Posts: 2596
Re: How to blank out number of guests online
« Reply #1 on: January 29, 2022, 05:26:52 AM »
You will have to edit SSI.php as that’s the function we call. The easiest way will be to just remove the part where it echo’s the number of guests.

I can’t access SMF2.0’s code currently as it’s not on GitHub but I expect it will be the same as 2.1 where it’s just after the integrate function that you have to edit.

Most of those guests will be bots or similar trying to crawl the site.

Offline North East Man

  • Jr. Member
  • **
  • Posts: 13
Re: How to blank out number of guests online
« Reply #2 on: January 29, 2022, 08:25:47 AM »
Thanks for your reply.  I have looked in SSI.php and the only lines that I can see are


//   echo '
//      ', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users'];



I have commented the lines out as shown above having first tried just deleting the part of the line that refers to guests.  That didn't make any difference, so I tried commenting out the whole 2 lines of code as above - that still didn't make any difference either as the information still shows.  I can turn offthe block in TP and everything disappears, but I really like having who's online showing with their avatar.

I couldn't see anywhere in SSI.php where there was any mention of "integrate".

So I'm no further forward really.  Any other suggestions?

Thanks for your assistance


Offline @rjen

  • Support Team
  • *
  • Posts: 3252
    • FJR-club Nederland
Re: How to blank out number of guests online
« Reply #3 on: January 29, 2022, 09:25:50 AM »
I think it is possible, but I need access to a pc to check.

Will look into this later.

I think the ssi_online is not used to output online with avatars. That’s probably why your edits don’t make a difference . Just for fun switch off tha avatars and try again...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline North East Man

  • Jr. Member
  • **
  • Posts: 13
Re: How to blank out number of guests online
« Reply #4 on: January 29, 2022, 09:44:23 AM »
Hi @Rjen,

With the code lines active in SSI.php I turned off the avatars in TP - the site just showed my name as being online but with no numbers of users shown and no guests - not even the text of users and guest online. 

With Avatars off and the lines commented out - the site showed just my name.  No atars and no text to say how many users and guests.

With avatars on and code commented out - back to just showing my avatar with no name but also showing 0 guests and 1 user.

Thanks for the help.

Offline @rjen

  • Support Team
  • *
  • Posts: 3252
    • FJR-club Nederland
Re: How to blank out number of guests online
« Reply #5 on: January 29, 2022, 09:58:42 AM »
That confirms my statement. The display with avatars is elsewhere in the code.

I will not be near a pc before tomorrownight. So can’t help you today...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline North East Man

  • Jr. Member
  • **
  • Posts: 13
Re: How to blank out number of guests online
« Reply #6 on: January 29, 2022, 11:28:44 AM »
No problem @Rjen.  I’m away from my PC myself now until tomorrow and this issue has been on my wish list for a while so am more than happy to wait for a solution.

Offline tino

  • Developer
  • *
  • Posts: 2596
Re: How to blank out number of guests online
« Reply #7 on: January 29, 2022, 12:14:06 PM »
No problem @Rjen.  I’m away from my PC myself now until tomorrow and this issue has been on my wish list for a while so am more than happy to wait for a solution.

Ohh if you’re using avatars you just need to remove this line TPSubs.php

https://github.com/Tinyportal/TinyPortal/blob/5978395e9f32b013a1d41fb1a5bd07fa2a4f397d/Themes/default/TPsubs.template.php#L1025

Offline @rjen

  • Support Team
  • *
  • Posts: 3252
    • FJR-club Nederland
Re: How to blank out number of guests online
« Reply #8 on: January 29, 2022, 12:24:37 PM »
Yeah, that’s the one.

I am thinking; perhaps we can include a switch in the block setting in a next release.

That way an admin can suppress the guests without changing code
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline North East Man

  • Jr. Member
  • **
  • Posts: 13
Re: How to blank out number of guests online
« Reply #9 on: January 30, 2022, 05:41:59 AM »
That did it - guests no longer show.  Perfect!

Of course I'll still get the questions when the number of users online doesn't match the number of avatars shown when people haven't uploaded an avatar!  But you can't have everything.

I think an admin switch / tick box in the next release would be a great idea.  For the moment I just had to delete the line as the //comment didn't deactivate the line.

Many, many thanks for your assistance.

Richard