News:

Wondering if this will always be free?  See why free is better.

Main Menu

Users Online For Admin Only?

Started by RudyP, October 01, 2018, 05:16:46 PM

Previous topic - Next topic

RudyP

I want to have the users online info in the board index info center just for the admin. I tried unchecking the view users online in permissions of the member and this doesn't seem to affect anything.

I installed a mod that adds a permission that hides the entire info center from them but it removes the whole thing including recent post and private messages.

Again I just want  to have the info about users online, most online blah blah only visible to the admin but while keeping the rest.

Thanks!

RudyP

I got it sorted out. This did it if anyone is curious.

Quote from: Rain Forest on August 12, 2014, 11:09:36 AM
Ok :)

Finally!

Adding:
if ($context['user']['is_admin']) {


Before
echo '
<div class="title_barIC">
<h4 class="titlebg">
<span class="ie6_header floatleft">
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who' . '">' : '', '<img class="icon" src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['online_users'], '" />', $context['show_who'] ? '</a>' : '', '
', $txt['online_users'], '
</span>
</h4>
</div>
<p class="inline stats">
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];

// Handle hidden users and buddies.
$bracketList = array();
if ($context['show_buddies'])
$bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
if (!empty($context['num_spiders']))
$bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
if (!empty($context['num_users_hidden']))
$bracketList[] = comma_format($context['num_users_hidden']) . ' ' . $txt['hidden'];

if (!empty($bracketList))
echo ' (' . implode(', ', $bracketList) . ')';

echo $context['show_who'] ? '</a>' : '', '
</p>
<p class="inline smalltext">';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

// Showing membergroups?
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
<br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';
}

echo '
</p>
<p class="last smalltext">
', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
</p>';


and adding this after that code

}
worked for me! Only admins can see it now.
Thanks! :)

njtweb


Shambles

Quote from: njtweb
What file are you editing?

My guess would be BoardIndex.template.php

RudyP

Quote from: Sh@mbles on October 02, 2018, 09:32:27 AM
Quote from: njtweb
What file are you editing?

My guess would be BoardIndex.template.php

Yep that's it. I guess I should have mentioned that...

Advertisement: