Extension:Chat

The Chat extension adds a chat tab to every wiki article that switches to an embedded chatroom with the same name as the article title. It can be configured to have only one chatroom for the entire site, rather than one chatroom per article (the default). This extension uses PhpFreeChat.

Usage
Once the extension is installed, a 'chat' tab will appear on every article. Clicking on the chat tab will switch to an embedded chatroom for the article.

Prerequisite
You MUST be using MySQL as the MediaWiki database for this extension to work.

Installation
Quick start instructions are below.

Detailed instructions can be found here on WikiChat.org

Just five easy steps:-
 * 1. Download PhpFreeChat 1.2 (google it) and follow the installation instructions to install it into your wiki somewhere. I have mine under /wiki/phpfreechat. (NOTE: You MUST download exactly phpfreechat 1.2)


 * 2.
 * Create a file called "WikiChat.php" in your wiki extensions/WikiChat directory (which you will need to create) and copy the WikiChat.php source code into it.
 * Create a file called "DatabaseFunctions.php" in your wiki extensions/WikiChat directory and copy the DatabaseFunctions.php source code into it.


 * 3. Modify the directory path at the top of WikiChat.php to point to your PhpFreeChat installation directory:-

define('WC_PFC_DIRECTORY', 'phpfreechat');


 * 4. Add this line to the end of LocalSettings.php:

require_once( "$IP/extensions/WikiChat/WikiChat.php" );


 * 5. You might need to change the access permissions on some of the directories...

phpfreechat-x.x/data/private directories.
 * 1) Give the web server write rights to phpfreechat-x.x/data/public and

If you are using FTP:

CHMOD 777 phpfreechat-x.x/data/private

CHMOD 777 phpfreechat-x.x/data/public

If you are using SSH:

chmod 777 phpfreechat-x.x/data/*

Its probably more sensible to use 755 than 777.

The chat function should be working now. Refresh your main page (or any page) and you should see a "chat" tab at the top. Click on the tab to start chatting.

Please report any issues by adding them to the discussion for this extension.

Chat not loading?
If you are still having problems you may need to manually "rehash" the chat cache. Make sure to read this discussion. For an explanation of rehashing see this page.

You may also like to read the known issues.

Optional Parameters
Most of the optional parameters in WikiChat.php are parameters to PhpFreeChat. You need to refer to the PhpFreeChat documentation for information about how to change the PhpFreeChat parameters. See http://www.phpfreechat.net/parameters for information on particular parameters.

WikiChat optional parameters are detailed below...

Disabling Anonymous Access
Anonymous users are allowed access to the chatroom by default and assume the nickname 'Guest'

If you would like to deny access to anonymous users change the appropriate define statements at the top of WikiChat.php:

define('WC_ALLOW_ANONYMOUS_USERS', false);

define('WC_DENY_ACCESS_MESSAGE', 'whatever you want displayed to the user when denied access');

Making all tabs point to one chatroom
The default setting is to open a new chatroom tab for each article, with the name of the article as the title of the chatroom. This is set by the following line in WikiChat.php

define('WC_ROOM_PER_ARTICLE', true);

If you would like to have all articles share one room then you need to change that line to:-

define('WC_ROOM_PER_ARTICLE', false);

All articles will now put users entering through the chat tab, into the single site-wide chatroom.

Other parameters
Place these parameters after the  line in LocalSettings.php.

Help with chat commands
Detailed help is available on WikiChat.org

Known issues

 * Sometimes when entering the chatroom you get a message saying you are not allowed that nickname (because it is in use). This occurs because a user of that name is already in the chat room. Note that when a user closes their browser to leave a chatroom it takes a long time before their chat session ends. This is a limitation of browsers as there is no way catch a window close event for all browsers and automatically end the chat user's session.
 * Error: 'chat.js.tpl.php' could not be found, please check your themepath This can happen if you move your wiki to a different path; it is a result of cached files in phpfreechat/data/private/cache retaining your original path. Delete those files and all will be well.

ChangeLog
0.3.9, 2012.08.30
 * Added support for table prefixes
 * Added support for sysops and other user groups to be automatically added as moderators
 * Added Vector support
 * Added DatabaseFunctions.php
 * Changed getDBKey to getPrefixedText so room names would have namespace prefix
 * Added a bunch of globals

0.3.8, 2010-09-03
 * fixed bug where MYSQL returned error 1071 caused by the index being >1024 bytes. Keys sizes have been reduced in the chathistory table.

0.3.7, 2010-02-01
 * fixed bug where chat didn't work on subpages i.e. /wiki/index.php/Page/SubPage

0.3.6, 2010-01-26
 * changed it so that anonymous users can pick their nickname when they join the chat. Will make it a configurable option in the future so that anonymous users can optionally be assigned a fixed nickname as it was in previous versions e.g. 'Guest'.
 * fixed a bug where the deny access message wasn't displayed when WikiChat was configured to deny access to anonymous users.
 * put the following code back in as it is needed so that phpfreechat can find itself in wiki installations that are below the web root e.g. http://example.com/abc/def/wiki. Check the discussion page if you have this kind of wiki installation and WikiChat is not working.

$params["data_public_url"] = "$wgPFC_Directory/data/public"; $params["data_public_path"] = "$wgPFC_Directory/data/public";

0.3.4, 2010-01-22
 * fixed bug where chat wouldn't work properly for pages with a space in the title
 * fixed bug where anonymous users wouldn't be prevented from access when configured to deny them
 * chat logging is now going into the database
 * refactored the code to make it easier to maintain
 * changed user configuration options to use define statements like MediaWiki does
 * fixed small security hole

0.3.2, 2010-01-21
 * fixed page title
 * made room per article function configurable through a configuration variable
 * made configuration a tiny bit easier by adding the $wgPFC_Directory variable

0.3.0, 2010-01-20
 * updated the code to work with PhpFreeChat 1.2
 * fixed the issue where "Chat loading" is displayed but the chat never finishes loading.
 * tested and working on MediaWiki 1.15.1
 * new source code below
 * Firebreather 09:48, 20 January 2010 (UTC)

0.2.2, 2007-07-25
 * changed the default setting for the "timeout" parameter to increase the amount time before a user is disconnected. The default setting is ridiculously low.

0.2.1, 2007-07-03
 * upgraded WikiChat.php to be compatible with phpfreechat-1.0-beta11. It now won't work with earlier versions of phpfreechat. Phpfreechat-1.0-beta11 has lots of bug fixes and is more stable with Internet Explorer. If you were having problems with IE or other connectivity issues, this release should fix them.

0.2, 2007-06-06
 * fixed the html and page title so they are now there
 * added an option to disable anonymous user access and display a wikitext message instead
 * added a small message at the bottom to 'type /help for a list of all commands'

0.11
 * fixed two bugs that could blow up Special:Version page

0.1
 * first release

Source code
First check which version of MediaWiki you are using.

For 1.19 and later use MediaWiki 1.19 and later.

For 1.16 use MediaWiki 1.16.

For releases prior to 1.16 use MediaWiki prior to 1.16.

MediaWiki 1.16
Save WikiChat.php in the "extensions/WikiChat" directory.

MediaWiki 1.16
Save WikiChat.php in the "extensions" directory.

MediaWiki prior to 1.16
Save WikiChat.php in the "extensions" directory.

Site List
Please add your wiki to the site list so we can visit you to see how you're using WikiChat and how to improve it. We'll also put a link to your wiki on the front page of WikiChat.org.