MyBB Community Forums

Full Version: AJAX Chat - including MyBB integration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
kamikaze666 Wrote:1. how can i make my shoutbox work like the one on your forum??? i mean in a pop-up window with a fixed height and width???
How to open the chat in a new window with a predefined size

kamikaze666 Wrote:2. will the link on my forum show the number of loged users in the chat by default or do i have to add something else to the code ???pls tell me !!!
You have to add some additional code. There is already a howto for phpBB and I'll add one for MyBB.
madblueimp Wrote:
kamikaze666 Wrote:2. will the link on my forum show the number of loged users in the chat by default or do i have to add something else to the code ???pls tell me !!!
You have to add some additional code. There is already a howto for phpBB and I'll add one for MyBB.
i have a question: when will you add the howto for mybb ?
kamikaze666 Wrote:i have a question: when will you add the howto for mybb ?
It's done when it's done. Wink
could someone please tell me how can i change the submit, logout & login buttons into pictures ???
kamikaze666 Wrote:could someone please tell me how can i change the submit, logout & login buttons into pictures ???
Either use
<input type="image" src="your_button_image.png"/>
for these buttons or better use CSS to assign a background-picture:
<input type="submit" name="name" value="value" style="background-image:url('your_button_image.png');border:none;"/>
The style declarations should be put into the css files, not used inline, though.
kamikaze666 Wrote:i have a question: when will you add the howto for mybb ?
I'm sorry, but I won't get the time to dive into MyBB details in the near future.
I guess the adjustments are only minimal, but I'm not a MyBB modification developer and just don't have the time currently.

I can tell you the code that is needed to access AJAX Chat, and maybe someone with MyBB Modification development experience can take this up and write a short howto.

You only need the following functions to access the AJAX Chat interface and to use it to get the online users (their names) and the ID's of those online users:
function getChatInterface() {
   static $ajaxChat;
   
   if(!$ajaxChat) {
      // URL to the chat directory:
      if(!defined('AJAX_CHAT_URL')) {
         define('AJAX_CHAT_URL', './chat/');
      }
      
      // Path to the chat directory:
      if(!defined('AJAX_CHAT_PATH')) {
         define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/chat').'/');
      }
      
      // Validate the path to the chat:
      if(is_file(AJAX_CHAT_PATH.'lib/classes.php')) {
         
         // Include Class libraries:
         require_once(AJAX_CHAT_PATH.'lib/classes.php');
         
         // Initialize the chat interface:
         $ajaxChat = new CustomAJAXChatInterface();
      }
   }
   
   return $ajaxChat;
}

function getChatOnlineUsers() {
   return ($chatInterface = getChatInterface()) ? $chatInterface->getOnlineUsers() : array();
}

function getChatOnlineUserIDs() {
   return ($chatInterface = getChatInterface()) ? $chatInterface->getOnlineUserIDs() : array();
}
The methods used are already written with performance in mind and will need only one SQL query, no matter how often you call them.
Ok i love this chat room, much respect and appreciation!

It integrates very nicely into MYBB. I have it opening in a new window with set height and width.

I'm using MYSQL version 5.0.45 but MYBB is MYSQL... I don't want to use the Improved version as it breaks several of my other mods...

When i try to run the chat in MYSQL version it opens up with an empty chat room, no online members, no text or anything but if i change it to MYSQLI within the MYBB config file it works just fine...

I see that the AJAX Chat works with both MYSQL and MYSQLI but prefers MYSQLI... So why does it only work for the one on my forums??

I posted here as i weren't sure if this related to MYBB or what Smile

Any help you can suggest is greatly appreciated Smile
Your answer is in the FAQ:
How to setup the database connection
(The MySQL - MySQLi issue is described there)
Smile
Oooh, sorry about that... I had looked over the FAQ's too, i must be blind!! Thanks for the help and sorry for pestering you hehe Smile
No problem. Smile
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38