Introducing the Prochatrooms to XOOPS integration How To
  • 2013/5/3 16:10

  • xoobaru

  • Just can't stay away

  • Posts: 494

  • Since: 2010/12/2

Here are the instructions for integrating Prochatrooms with XOOPS. It will allow users to auto authenticate to the Prochatrooms dialog with their usernames. It does not return users chatroom status to their online status in XOOPS, but does give you the option to create a custom XOOPS block that will show chat user status separately.

Since there is no multi-room public chatroom module available for XOOPS at this time, many users who need chatroom functionality might appreciate a great low cost alternative to integrate their XOOPS with a commercial chatroom script until a viable dedicated chat module does become available. One of the nicest and lowest cost chatroom scripts is ProChatrooms.


At aprox. $55.00 USD price tag (way under FlashChat 123), PCR is not a cost obstacle. With PCR, webmasters can set up multiple public/private, user creatable, password access optioned chatrooms. A host of versatile plugins including web video chat (additional flash server required so webcam ops are better for dedicated servers, or shared hosting with separtately hosted flash server).

PCRs chat method is non IRC, but has IRC type command emulator for some traditional chatroom functions. PCR user to user chat traffic is fully https compliant. Although it is currently on version 7, V8 is about to be released which will include mobile theme capability as well. It should mesh nicely with the launch of the XOOPSFrance mobile theme.


Prochatrooms uses chat.js in its root directory to create a chatroom window, and log a CMS user into the chatroom by username. The integration method below captures a logged in XOOPS users authentication as the theme loads, which then becomes available to PCR's chat.js when it gets called as a users clicks on the chatroom link. The end result is that the user gets logged in automatically as their username into a chat window.

This example assumes you are installing it in a directory within the modules directory. It does not have to be here, but should be somewhere withing XOOPS field of view. Just make sure the paths specified below and in chat.js reflect whatever location you are using.

You can change the Prochatrooms install directory name to whatever you like.


1. Follow the standard Prochatrooms installation procedure into the /modules/prochatrooms/ location. Verify first that it works correctly as a standalone installation. Then go into the config php and change the CMS integration option to on (=1). This will disable standalone access, and allow access only via CMS. It also has its own separate profile which you may want to disable here (=0) as XOOPS already has one.

2. If you want to use your chatroom under forced https, then https should be hardcoded into the path line of PCR chat.js.

3. Customize your style.css to suit your theme attributes.

4. You can create a custom whos chatting XOOPS status block using an iframe html code PCR makes available to you in the PCR admin back end.


1. Add following smarty compatible php code to <head> section of theme.html or whatever html page your theme uses.

<{php}> if (is_object($GLOBALS['xoopsUser'])) {       echo '<script type="text/javascript" >       var userName = "'.$GLOBALS['xoopsUser']->getVar('uname').'";       var userID = "'.$GLOBALS['xoopsUser']->getVar('uid').'";       var roomID = "Lobby"; </script>';       echo '<script type="text/javascript" src="'.XOOPS_URL.'/modules/yourdirectoryname/chat.js"></script>';       } <{/php}>

If you have renamed your default room in PCR, change the word Lobby above to whatever you named the room.

2. To verify you are correctly capturing your user variables When theme loads, check your browsers "view source code" resource confirms that userName and userID variablesare being successfully populated. If your browser does not have one, try using the JS source code monitor in the Firebug add on for Firefox when accessing your site. You should see this somewhere in the script display:

var userName "your username";        var userID "1";        var roomID "Lobby";

You should not proceed further until you verify that you first get this result, because everything else builds on this. If you do not see it, double check the code and try cleaning your smarty compile templates and then reload the theme.

The view source code resource also confirms that the specified path to the PCR chat.js script is being called correctly. You should see this:

</script><script type="text/javascript" src="https://www.yoursite.com/modules/yourdirectoryname/chat.js"></script>

As stated above, if you want to force https, it needs to be hardcoded into PCR chat.js file as https in the pathline. This line looks like this:

var chatUrl 'https://'+location.hostname+'/modules/yourdirectoryname/index.php?uid='+userID+'&uname='+userName+'&room='+roomID;

3. The URL the user clicks on to launch the chatroom is rather unconventional. Just set up with a custom html link, perhaps using an untitled block inside a html table cell as a placeholder.

A. For a URL assigned to a custom icon:

if (is_object($GLOBALS['xoopsUser'])) { ?> <a href="javascript:launchChat();"><img src="https://www.yoursite.com/themes/yourthemename/images/chat-icon.png" width="XX" height="XX" border="0"/></a>

Change path, image name, theme, and size variables to your requirements. And make sure the icon is there.

B. For a text only URL

if (is_object($GLOBALS['xoopsUser'])) { ?> <a href="javascript:launchChat();"><Chatrooms></a>

4. Clicking on the chat icon for this url should open up a normal PCR browser window, log the user in by username, and display the following url in the browser:

https://www.yoursite.com/modules/yourd ... e=yourusername&room=Lobby

This verifies that chat.js was correctly called and the URL string was successfully concatenated with the userID and userName variables. If this is not correct, you need to adjust the hard coded path settings in chat.js. Always keep a backup of the pre-change file so you can revert back if you do something wrong.

If all checks out, you and your users are now ready to use the chatrooms.

Credits go to Wishcraft for the coding who did this under contract to me.

Re: Introducing the Prochatrooms to XOOPS integration How To

Thanks. I am upto Prochatrooms 7.13 I did give it to PCR to distribute, it seems to need no intergration, just install, press the update button in the modules admin once and you should be able to run it no worries.


Re: Introducing the Prochatrooms to XOOPS integration How To
  • 2013/5/3 18:59

  • xoobaru

  • Just can't stay away

  • Posts: 494

  • Since: 2010/12/2

They had it in their CMS integration library page for awhile, but it isn't there now so don't know what that deal is. It may be that it was locked into a fixed version and are now up to 7.5.2

You must have diversified into genetic experimentation (Koalas?) as I notice a little more hair growth around the ears than is usual. When doing those things, just make sure you TEST TEST TEST before trying.

Re: Introducing the Prochatrooms to XOOPS integration How To

Lol no it is my Cat ears beanie i have.. It is coming on winter here in sydney, and you know it cold in the morning... Will wear it too work if i get one of the Jobs I am in, the last 7 years open sourcing has left me in around 17k debt; so I need a contract to tidy up my financials...


Who's Online

77 user(s) are online (47 user(s) are browsing Support Forums)

Members: 0

Guests: 77



Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits