MyBB Community Forums

Full Version: How can i put "admin-mod-user" text on the whosonline ??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to put it on the whosonlie, not nearby...

mine is this> [Image: i68497_untjFDFDitled.JPG]

how can i do that ??
my code is this>

PHP Code:
<tr>
<
td class="tcat"><strong>$lang->whos_online</strong> [<a href="online.php">$lang->complete_list</a>]</td>
</
tr>
<
tr>
<
td class="trow1"><span class="smalltext">$lang->online_note 
[ <font color="#9900ff"><b>Admin</b></font> ]
[ <
font color="red"><b>�zel �ye</b></font> ]
[ <
font color="#0000ff"><b>Y�netici</b></font> ]
[ <
font color="#006600"><b>Super Mod</b></font> ] 
[ <
font color="#993300"><b>Moderat�r</b></font>] 
[ <
font color="#cc6600"><b>ModAday&yacute;</b></font> ]
[ <
font color="#0033cc">�yeler</font> ]
<
br /> <br />
$onlinemembers
</span></td>
</
tr

Since I wanted this list in multiple places (Who's Online block on the index page, Member List, etc), I made a function. $open get prepended to every formatted name, while $close gets appended. The string {gid} will be translated to the actual group id, so you could include URLs (for example, link to a modified memberlist.php which only lists users who belong to a certain group).

function formattedgrouparray( $open="", $close="")
{
  global $db, $mybb, $settings, $lang;
  $query = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroups WHERE gid!=1 ORDER BY isbannedgroup ASC, showforumteam DESC, issupermod DESC, usertitle");
  $groups = array();
  while ( $group = $db->fetch_array($query) )
  {
    $my_open = str_replace( array("{gid}"), array($group['gid']), $open);
    $my_close = str_replace( array("{gid}"), array($group['gid']), $close);
    $title = ($group['usertitle']) ? $group['usertitle'] : $group['title'];
    $groups[] = $my_open . formatname( $title, $group['gid'] ) . $my_close;
  }
  return $groups;
}

You include the following code on each page you want the legend to show up (not: I should allow the word Legend to be translated):

$groups = formattedgrouparray();
$groups_legend = "<b>Legend</b>: " . join(" &nbsp;|&nbsp; ", $groups);

Then I added the variable $groups_legend to the template.
Man thnks a lot...