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.
ABOUT 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.
HOW IT WORKS
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.
PROCHATROOMS RELATED STEPS
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.
XOOPS RELATED STEPS
1. Add following smarty compatible php code to section of theme.html or whatever html page your theme uses.
<{php}> if (is_object($GLOBALS['xoopsUser'])) { echo ''; echo ''; } <{/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'])) { ?>
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'])) { ?>
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/yourdirectoryname/index.php?uid=1&uname=yourusername&room=LobbyThis 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.