MyBB Community Forums

Full Version: whos online
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i think itd be nice to have an admistrator option to disable/enable the whos online page on a per group basis.

theres already an option for this however id like it a bit different id like the people allowed to see on index.php whos online but not to have the [Complete List] link.
so i have a way to do this but it isnt working properly so maybe someone can help me figure it out Smile

first of all id like to have phpcode in a template, is that possible?

heres what i have in the index_whosonline template currently
<tr>
<td class="tcat" colspan=""><strong>$lang->whos_online</strong> 
<?php
if($mybb->usergroup['canviewonline'] != "no")
{
echo ("[<a href='online.php'>$lang->complete_list</a>]");
}
?>
</td>
</tr>
<tr>
<td class="trow1" colspan=""><span class="smalltext">$lang->online_note<br />$onlinemembers</span></td>
</tr>

i have changed index.php from this:
if($mybb->settings['showwol'] != "no" && $mybb->usergroup['canviewonline'] != "no")
to this:
if($mybb->settings['showwol'] != "no")

it actually produces some output like this for index.php (when you go to the forum index page):
Board Statistics 
Who's Online Complete List]"); } ?> 

with no link in the html and if you look at the source it looks like this:
<!-- start: index_whosonline -->
<tr>
<td class="tcat" colspan="4"><strong>Who's Online</strong> 
<?php
if(Array['canviewonline'] != "no")
{
echo ("[<a href='online.php'>Complete List</a>]");
}
?>
</td>
it started out as a suggestion but turned into a mod

maybe a mod should move this to the modifications subforum Wink
Moved to code modifications forum.
i have figured this out

from what i can tell you cannot have php code in templates

so ive changed index.php the following ways:
this:
if($mybb->settings['showwol'] != "no" && $mybb->usergroup['canviewonline'] != "no")

is now this:
if($mybb->settings['showwol'] != "no")

and below this:
$doneusers = array();

i added this:
        if($mybb->usergroup['canviewonline'] != "no")
        {
                $whosonlinelink = "[<a href='online.php'>$lang->complete_list</a>]";
        }

then in the index_whosonline template i have this:
<tr>
<td class="tcat" colspan=""><strong>$lang->whos_online</strong> 
$whosonlinelink
</td>
</tr>
<tr>
<td class="trow1" colspan=""><span class="smalltext">$lang->online_note<br />$onlinemembers</span></td>
</tr>

now in options the 'Can View Board: yes/no' option per group is allowing whether that link is there or not