2022-02-05, 01:31 PM
function emeraldextended_online()
{
global $mybb, $db, $cache, $templates, $lang, $staffline_list;
// Get the online users.
$timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
$comma = '';
$query = $db->query("
SELECT s.sid, s.ip, s.uid, s.time, s.location, s.location1, u.avatar, u.username, u.invisible, u.usergroup, u.displaygroup
FROM ".TABLE_PREFIX."sessions s
LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
WHERE s.time>'$timesearch'
ORDER BY u.username ASC, s.time DESC
");
$forum_viewers = array();
$staffcount = 0;
$staffline_list = '';
$doneusers = array();
$ug = $cache->read("usergroups");
// Loop through all users.
while($user = $db->fetch_array($query)) {
$is_staff = ($ug[$user['usergroup']]['cancp'] || $ug[$user['usergroup']]['canmodcp']);
if(($user['uid'] > 0 && $is_staff) && ($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])) {
if($user['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid']) {
// Properly format the username and assign the template.
$user['profilelink'] = build_profile_link($user['username'], $user['uid']);
$avatar = $user['avatar'];
$pseudo = $user['username'];
$pflink = $user['profilelink'];
$uid = $user['uid'];
$user['avatar'] = '<a href="member.php?action=profile&id='.$uid.'"><img src="'.$avatar.'" title="'.$pseudo.'" class="avatarep_img"></a>';
$staffline_list .= $user['avatar'];
}
// This user has been handled.
$doneusers[$user['uid']] = $user['time'];
}
}
if (empty($staffline_list)) {
$staffline_list = "No online staff.";
}
}
function emeraldextended_default_avatar()
{
global $mybb, $db, $templates, $memprofile, $customcolor_headerinclude;
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
eval("\$customcolor_headerinclude = \"".$templates->get("customcolor_headerinclude")."\";");
$db->query("UPDATE ".TABLE_PREFIX."users SET avatar = 'images/default_avatar.png' WHERE avatar = ''");
if (empty($mybb->user['avatar']))
{
$mybb->user['avatar'] = "images/default_avatar.png";
}
if (isset($mybb->user['profilecover']) && $mybb->user['profilecover'] != "")
{
return;
}
else
{
$mybb->user['profilecover'] = $mybb->settings['emeraldextended_cover'];
}
}
i want to have online staff member's avatar in index i don't know how make a olugin using this function.....