• Welcome to Simple Machines Community Forum. Please login or sign up.
December 09, 2021, 08:06:07 AM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


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)?
No good deed goes unpunished
All helpful urges should be circumvented

Horme Gaming

hi spiros, best advice would be ask Antes in the topic, its been 6 days so I would message him.

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?
No good deed goes unpunished
All helpful urges should be circumvented

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

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"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!
<werbung>Meine Freundin hat ihr erstes Buch veröffentlicht!</werbung>

spiros


Advertisement: