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).
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)?
hi spiros, best advice would be ask Antes in the topic, its been 6 days so I would message him.
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>' : '';
Thanks again Antes! Most valuable help. Just tried, but still shows green to a guest.
Is $user_info in the list of global variables for that function?
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>' : '';
so, put it into the globals list
Thanks, where/how do I do that?
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.
Excellent, thank you!