Question

I'm trying to implement a Chat Room for a forum of mine. I built the Chatroom myself using PHP and Ajax, but I'm also trying to figure out how to only allow users that are part of my MyBB forum to use the Chat.

So what I'm basically trying to do is:

  • List users in chatroom
  • Only allow users that are logged in to Chat

I have no idea how to do this. I'm assuming I have to edit the cookies that MyBB stores. But the MyBB wiki doesn't give much information out but what is stored in the cookie.

I'm a bit new to PHP and I'm wondering how to start on this, so I'm wondering what do I need to do to get this to work the way I want?

Was it helpful?

Solution

Just include MyBB's global.php file. It will do all work for you.

Then you can use $mybb->user array to get any information about the current user.

$isLoggedIn = ($mybb->user['uid'] > 0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top