MyBB Community Forums

Full Version: How to integrate AJAX Chat with your MyBB theme
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
First tutorial, I wanted to share with everybody how I got AJAX Chat integrated nicely with the forum theme, without using it as a shoutbox as some other tutorials have taught.

Important Note: I only provide support for my guide, not the software used in it. This means if you have a problem with AJAX Chat or the Pages plugin then take it to the appropriate thread unless it's a web address error, like it's not loading in the page or similar.

Alright, so first we need the following things:

First, download and install AJAX Chat. There is a readme in the archive on how to do it.
Then, extract and upload Page Manager. Activate it in your ACP.

Ok, now for a little HTML:
  1. Go to ACP>Configuration>Page Manager
  2. Click "Add New Page"
  3. Give it a name (like AJAX Chat or Chatroom, this will appear on the browser tab or the window title)
  4. Now, in the URI parameter box, put a name like chat or something. This will in the end be our page's address.
  5. Make sure "Use MyBB template" is on.
  6. Then paste the following in the Page content box:
    <iframe src="http://www.example.com/chat" width="100%" height=800></iframe>
Replace "www.example.com/chat" with the directory you installed AJAX Chat to.
You can change the height if need be, but leave the width as it is.

Now click "Save and return to listing" and then under your new page's name select the address, which will appear similar to http://www.example.com/misc.php?page=chat

You can then take this address and add it to your forum's nav bar and you're all set!

Tip: To change the default theme for AJAX Chat, go to /lib/ in the directory in which you installed AJAX Chat and edit config.php:

Find the following code:
Quote:// Available styles:
$config['styleAvailable'] = array('beige','black','grey','Oxygen','Lithium','Sulfur','Cobalt','Mercury','Radium','prosilver','subsilver2','subblack2','subSilver','Core','MyBB','vBulletin');
// Default style:
$config['styleDefault'] = 'MyBB';
Then enter the name of the style you want to be default in the last line,
Quote:$config['styleDefault'] = 'MyBB';
And replace "MyBB" (or whatever) with the name of the theme you want.
Save and refresh the page you created with page manager.

Hope this guide comes in handy for someone. Probably looks noobish but hey, I'm still learning Toungue
Some feedback would be nice Wink
I got this error when I am about to install AJAX Chat for MyBB by accessing the install.php.
Quote:Query: DROP TABLE IF EXISTS ajax_chat_online; Error-Report: Error-Code:

Basically, I'm stuck at step 2 found in the readme.txt
Quote:1. Upload to the server
--------------------

Upload the chat folder to your server into your MyBB forum directory:
e.g. http://example.org/mybb/chat/


2. Creation of database tables
---------------------------

Execute the provided installation script by visiting the following URL with your browser:
http://example.org/mybb/chat/install.php

Replace "http://example.org/mybb/chat/" with the real URL to your chat directory.

I tried to login and ignored the install.php and proceeded to the /chat directory and had this error.
Quote:Query: SELECT userID, userName, userRole, channel, UNIX_TIMESTAMP(dateTime) AS timeStamp, ip FROM ajax_chat_online ORDER BY userName; Error-Report: Error-Code:
Same Exact Error as the person above me.
I finally got it to work.

After doing this one:
Quote:1. Upload to the server
--------------------

Upload the chat folder to your server into your MyBB forum directory:
e.g. http://example.org/mybb/chat/

Follow this guide: http://community.mybb.com/thread-46457.html

Then finish the rest of the installation.

If you get an error:
Quote:TypeError: Object #<an HTMLObjectElement> has no method 'create'

Go to:
Quote:/public_html/chat/js/FABridge.js

Find:
Quote:if (/Explorer/.test(navigator.appName) || /Konqueror|Safari|KHTML/.test(navigator.appVersion))

Replace with:
Quote:if((!(/Chrome/.test(navigator.appVersion))) && ((/Explorer/.test(navigator.appName) || /Konqueror|Safari|KHTML/.test(navigator.appVersion))))

If it shows still, try to clear your browser cache. It should work after that.
I fixed that problem myself when I opened up /chat/lib/config.php and entered my MyBB forum database login details.

EDIT: But not the Chrome error. Thanks man Smile
Ok, Did that and got it Installed, but now I get this error:

XML Parsing Error: junk after document element
Location: http://sitename.co.cc/chat/
Line Number 387, Column 8:</html><br />
-------^


Edit: Nevermind, I guess it fixed itself.


Edit 2: and Now it's doing it again....... How do I fix this problem?
I don't know. I only provide support for my guide, not the software used in it.
The URL returned by Page Manager to be uglier and longer than I'd really like. Anyway to make it something like "forum.com/ajaxchat.php" as opposed to "forum.com/misc.php?page=ajaxchat"? Even a cleaner redirect link would suffice.

Also, I get the following pop-up error whenever I open up the page with the chat. Is it anything to worry about?

[Image: chaterror.png]

Anyway, great tut!

Cheers, Reece.

Add something like this to your .htaccess
RewriteRule ^page-([^./]+)$ misc.php?page=$1 [L,QSA,NC]

That will give you a URL of forum.com/page-ajaxchat (and you can use the same URL format for any other pages created in Page Manager).
Pages: 1 2 3 4