TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 10:38:18 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 212
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 45
  • Total: 45

How to blank out number of guests online

Started by North East Man, January 29, 2022, 12:00:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

North East Man


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?

tino

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.

North East Man

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


@rjen

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

North East Man

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.

@rjen

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

North East Man

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.

tino

Quote from: North East Man on January 29, 2022, 06:28:44 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

@rjen

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

North East Man

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