Thursday, March 28, 2024

How to Add Facebook Style Instant Messaging to Your Discussion Forum

If you are a user of Facebook, you are probably familiar with its Instant Messaging feature which enables you to chat with your Facebook friends if they are online. Using CometChat, you can add that functionality to your site’s vBulletin discussion forum.


I have used most of the popular social networking site’s IM services, but found Facebook’s service to be the most user friendly, with less potential issues than the others. Although vBulletin provides a Private Message feature, it’s not instant, live chat. I wanted something similar to the one that Facebook provides, and after some searching, I found CometChat.


While I would be installing CometChat on my vBulletin discussion forum, CometChat integrates seamlessly with many discussion forums and CMSs, including:


  • vBulletin
  • JomSocial
  • Community Builder
  • WordPress
  • SocialEngine
  • phpBB
  • Invision Power Board
  • Dzoic Handshakes

Features of CometChat are exactly the same as those of Facebook’s IM service, with the exception that it doesn’t show your friend’s avatars in the Who’s Online box (it does show it when chatting with a friend, however). For vBulletin users, it shows your friends from the discussion forum you are on, if they are online. You can either talk to them privately, or you can create (or join) a chatroom so more than one user can chat.


The software sells for $49 for the basic version with one year of updates and support. CometChat can run on any server that supports PHP and MySQL, and integration is fairly straight forward. Here is a shot of CometChat in use:


CometChat Installation for vBulletin


This tutorial assumes that you are already running vBulletin, have purchased CometChat, and are ready to install it. Once you have downloaded and unzipped the cometchat.zip file, you will need to upload the CometChat directory into the /forums folder (or where ever your vBulletin installation lives) on your server. There is also an extra file provided with CometChat that you will need to upload to your server, and you will find it once you have purchased the software (it provides support for user avatars).


Now it’s time to start the installation. You’ll want to point your web browser to:


http://www.domain.com/forums/cometchat/install.php

substituting your domain in the URL as appropriate. It will provide you with a link to see the footer code for your installation. Now you will need to login to your vBulletin discussion forum’s Administration Control Panel, and under the Styles & Templates tab, select the Style Manager. Now select the style in which you want to add the bar (usually the style that your forum is currently using), and click on the Go button.




In the header textbox, you will add the following at the start…this allows the script to use Google’s Ajax API:


<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js”></script>
<script>jqcc=jQuery.noConflict(true);</script>

In the footer textbox on that same tab, you will need to paste the footer code text (mentioned above) at the end of the code block. It will look something like this:

<!– CometChat Footer Code Start –>
<link type=”text/css” rel=”stylesheet” media=”all” href=”cometchat/cometchatcss.php” charset=”utf-8″ />
<script type=”text/javascript” src=”cometchat/cometchatjs.php” charset=”utf-8″></script>
<!– CometChat Footer Code End –>

All you need to do now is to delete the install.php file from the cometchat folder on your web server. When you login to your forum, you will see the CometChat IM bar at the bottom of the page. You can then customize the text, icons on the left, theme, etc. to further suit your site (I removed the icon/link to Single Player Games from the left, for instance).


You should be sure to test the responsiveness of your server once you have installed CometChat, but since it uses Ajax to refresh, it should not put undo stress on your server. Also, the folks at CometChat are still working on an update for vBulletin Community Suite 4.0, and are coming out with updates frequently, so if your forum isn’t listed, that doesn’t mean that aren’t working on it (Drupal anyone?).

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured