2011-11-30, 12:42 PM
2011-11-30, 01:21 PM
Taken from the ./showthread.php ;
You've to use the $lang->load("showthread"); at the top of this script to use the words used in this script, also you need to define the $tid which is the thread ID you want to show the users browsing from.
// Get users viewing this thread
if($mybb->settings['browsingthisthread'] != 0)
{
$timecut = TIME_NOW - $mybb->settings['wolcutoff'];
$comma = '';
$guestcount = 0;
$membercount = 0;
$inviscount = 0;
$onlinemembers = '';
$doneusers = array();
$query = $db->query("
SELECT s.ip, s.uid, s.time, 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 > '$timecut' AND location2='$tid' AND nopermission != 1
ORDER BY u.username ASC, s.time DESC
");
while($user = $db->fetch_array($query))
{
if($user['uid'] == 0)
{
++$guestcount;
}
else if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
{
++$membercount;
$doneusers[$user['uid']] = $user['time'];
$invisiblemark = '';
if($user['invisible'] == 1)
{
$invisiblemark = "*";
++$inviscount;
}
if($user['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])
{
$user['profilelink'] = get_profile_link($user['uid']);
$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
$user['reading'] = my_date($mybb->settings['timeformat'], $user['time']);
eval("\$onlinemembers .= \"".$templates->get("showthread_usersbrowsing_user", 1, 0)."\";");
$comma = $lang->comma;
}
}
}
if($guestcount)
{
$guestsonline = $lang->sprintf($lang->users_browsing_thread_guests, $guestcount);
}
if($guestcount && $onlinemembers)
{
$onlinesep = $lang->comma;
}
$invisonline = '';
if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1))
{
$invisonline = $lang->sprintf($lang->users_browsing_thread_invis, $inviscount);
}
if($invisonline != '' && $guestcount)
{
$onlinesep2 = $lang->comma;
}
You've to use the $lang->load("showthread"); at the top of this script to use the words used in this script, also you need to define the $tid which is the thread ID you want to show the users browsing from.
2011-12-01, 11:24 AM
Can you make it work? I'm accessing page url through mybb->input['page']=='my-page-name'