MyBB Support
Staff online in footer?
Submitted by Tutti Frutti, 25-07-2018, 12:09 AM, Thread ID: 96523
Thread Closed
RE: Staff online in footer?
25-07-2018, 12:41 AMAisaka Wrote: Just, for the love of god, don't edit the global.php.
Use hooks.
Edit: Nevermind. You're not supposed to replace your global.php.
This file goes to inc/plugins folder.
Edit 2:
Put the {$teamonline} somewhere in your template.
You didn't get my point lol nevermind figured it out.. I was trying to basically put the variable team online in the footer which wouldn't work so I had to add this in global.php which then worked.
PHP Code:
$teamonline = '';
if($mybb->settings['teamonline_gid'])
{
$gid = " IN (" . $mybb->settings['teamonline_gid'] . ")";
$timesearch = TIME_NOW - $mybb->settings['wolcutoffmins']*60;
$teamonline_row = '';
$trowbg = alt_trow();
$query = $db->query("
SELECT s.sid, s.ip, s.uid, u.username, s.time, u.avatar, u.usergroup, u.displaygroup, u.invisible
FROM ".TABLE_PREFIX."sessions s
LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
WHERE u.usergroup $gid AND time>'{$timesearch}'
ORDER BY u.username ASC, s.time DESC
");
if(!$db->num_rows($query))
{
eval("\$teamonline_no = \"".$templates->get("teamonline_no")."\";");
$invisible = 0;
$membercount = 0;
}
else
{
if(!is_array($groupscache))
$groupscache = $cache->read("usergroups");
while($online = $db->fetch_array($query))
{
$invisible_mark = '';
if($online['invisible'] == 1)
$invisible_mark = '*';
if($online['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $online['uid'] == $mybb->user['uid'])
{
$avatar_teamonline = format_avatar($online['avatar']);
$online['username'] = $online['username'];
$online['profilelink'] = build_profile_link($online['uid']).$invisible_mark;
$online['groupname'] = $groupscache[$online['usergroup']]['title'];
eval("\$teamonline_row .= \"".$templates->get("teamonline_row")."\";");
}
$invisible += $online['invisible'];
$membercount++;
}
}
eval("\$teamonline = \"".$templates->get("teamonline")."\";");
}
Users browsing this thread: 4 Guest(s)