MyBB Community Forums

Full Version: Site Online List Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Sort of like "Site News Plugin", I need something that allows you to insert "Who's Online" into the main web page. How do you do it??
Yes, this is needed, it would be great to have it
Can someone tell us? Doesn't HAVE to be a plugin, but how to intergrate it into website like $whoisonline in Portal pages?
I wanted to bump this because this is something I am looking for too.
I was going to bump this too. Can anyone direct us? Just direct us the way, don't have to make it.
You could just add a whoisonline variable that the "Who's Online" box does.
That would be the extreme basics.
But then you could use a snippet of the code found in the "Who's Online" box to make it look good I guess.

- Poomie
is it possbiel to move the active users to the top of the page?
I would have thought so.

- Poomie
Well in your site add the following

	//Connect to mybb db
	mysql_connect("localhost", "username", "password") or die("Could not connect to MySQL");
	mysql_select_db("db_name") or die("Could not connect to MySQL");
	
	$timesearch = time() - (15*60);
	$query = mysql_query("
		SELECT DISTINCT s.sid, s.uid, s.time,  u.username, u.invisible, u.usergroup, u.displaygroup
		FROM mybb_sessions s
		LEFT JOIN mybb_users u ON (s.uid=u.uid)
		WHERE s.time>'$timesearch'
		ORDER BY s.time DESC
	");
	$list = '';
	while($fetch = mysql_fetch_array($query))
	{
		if($fetch['invisible'] != "yes")
		{
			$list .= "<a href=\"member.php?action=profile&uid=".$fetch['uid']."\">".$fetch['username']."</a>";
		}
	}
	echo $list;


This is a stand alone code that doesn't require MyBB files or functions.

regards
Hey, Zaher! I have a question about your code.

$list .= "<a href=\"member.php?action=profile&uid=".$fetch['uid']."\">".$fetch['username']."</a>";

if you just put \"member.php on your root directory instead of your forum directory, won't that try to pull from there? Meaning www.mysite.com/member.php instead of www.mysite.com/forum/member.php ...Wouldn't that need to be

$list .= "<a href=\"forum/member.php?action=profile&uid=".$fetch['uid']."\">".$fetch['username']."</a>";
or am I reading too much into the code? Big Grin
Pages: 1 2