News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Hide online status in display.template (online/offline icon)

Started by spiros, May 21, 2020, 11:07:45 AM

Previous topic - Next topic

spiros

I am using this (as described here: https://www.simplemachines.org/community/index.php?topic=573194.msg4056070#msg4056070)

// Show online and offline buttons?
if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
echo '
', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="', $message['member']['online']['is_online'] ? 'on' : 'off' ,'"></span>', $context['can_send_pm'] ? '</a>' : '';


However, it appears that the default SMF behaviour is for the online icon to appear green for a user who is online, even if one is viewing the post as a guest. How can this be changed so that a guest always sees a gray image (off).

Arantor

Surely having the icon be visible and green indicates to guests that people are actually online and that the forum has activity with actual people (encourages further signups)?

Deaks

hi spiros, best advice would be ask Antes in the topic, its been 6 days so I would message him.
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Antes

I agree with Arantor on the subject but for some other reason if you want to make this happen;

// Show online and offline buttons?
if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
echo '
', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="', ($message['member']['online']['is_online'] && !$user_info['is_guest']) ? 'on' : 'off' ,'"></span>', $context['can_send_pm'] ? '</a>' : '';

spiros

Thanks again Antes! Most valuable help. Just tried, but still shows green to a guest.

Arantor

Is $user_info in the list of global variables for that function?

spiros

Apparently not. Even after reverting to previous version, I get:

8: Undefined variable: user_info
File: /Display.template.php
Line: 312


Previous version:

// Show online and offline buttons?
if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
echo '
', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="', ($message['member']['online']['is_online'] && !$user_info['is_guest']) ? 'on' : 'off' ,'"></span>', $context['can_send_pm'] ? '</a>' : '';

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

spiros


m4z

From line 312, move upwards to the beginning of the function. The first line inside the function (beginning with "global") defines the global variables available inside that function. Add "$user_info" to it.
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

spiros


Advertisement: