MyBB Community Forums

Full Version: User(s) browsing this thread/forum?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to show Google, Bing, Yahoo and other bots in User(s) browsing this thread/forum?
You will have to edit this code in forumdisplay.php and similar in showthread.php:
	$query = $db->query("
		SELECT s.ip, s.uid, u.username, s.time, u.invisible, u.usergroup, 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 location1='$fid' AND nopermission != 1
		ORDER BY u.username ASC, s.time DESC
	");

      while($user = $db->fetch_array($query))
	{
		if($user['uid'] == 0)
		{
			++$guestcount;
		}
		else
		{
			if(empty($doneusers[$user['uid']]) || $doneusers[$user['uid']] < $user['time'])
			{
				$doneusers[$user['uid']] = $user['time'];
				++$membercount;
				if($user['invisible'] == 1)
				{
					$invisiblemark = "*";
					++$inviscount;
				}
				else
				{
					$invisiblemark = '';
				}

				if($user['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])
				{
					$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
					$user['profilelink'] = build_profile_link($user['username'], $user['uid']);
					eval("\$onlinemembers .= \"".$templates->get("forumdisplay_usersbrowsing_user", 1, 0)."\";");
					$comma = $lang->comma;
				}
			}
		}
	}
so it is like online.php's code. In short, you need to additionally select s.sid in query, load spiders cache before while loop:
$spiders = $cache->read("spiders");
then check if bot string/key extracted from $user['sid'] exists in $spiders cache array. If yes, output the bot key's ['name'] from array and add a comma after it.
+1 My dear D666 thanks very much Wink