How To Add Chat Option On MediaWiki?

In addition to talk pages which are associated on every MediaWiki article, you can add a chat tab to enable live discussion and communication between users.

With Chat extension on your MediaWiki installation, you may either add a Chat tab to every wiki Article or configure it to have only one chatroom across all articles, rather than default i.e. one chatroom per article.

How To Setup MediaWiki Chat?

First download the code ZIP file from here then follow these quick setup instructions: (Detailed instructions can be found here on WikiChat.org).

Since Wiki Chat runs over phpFreeChat app, so first thing you need to do is install phpFreeChat on your hosting, somewhere like your domain.com/chat or where ever you like. Then follow the given steps:

  1. Unzip the archive localy then upload the “phpfreechat-x.x” directory on your server into a browsable directory (public directory). Tip: if you have a SSH access, I suggest to untar the archives directly on the server usign “tar xzf phpfreechat-x.x.tar.gz” command.
  2. Give the web server’s write permissions to “phpfreechat-x.x/data/public” and “phpfreechat-x.x/data/private” directories. If you are using FTP:
  3. 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/*

    Tip: On the latest version 1.x maybe it will not work and it will show you ”“Error: the chat cannot be loaded!…””, then try with 755 rights.

That’s it. Now you may browse the “phpfreechat-x.x” directory with your browser and continue with more steps to set it up working on your MediaWiki:

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.

Modify the directory path at the top of WikiChat.php to point to your phpFreeChat installation directory:-
define('WC_PFC_DIRECTORY', 'phpfreechat');
Add this line to the end of LocalSettings.php:
require_once( "$IP/extensions/WikiChat/WikiChat.php" );
Additionally, you might need to change the access permissions on some of the directories:
# Give the web server write rights to phpfreechat-x.x/data/public and 
phpfreechat-x.x/data/private directories.

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/*

That’s it. The chat should be working now in your MediaWiki website. Refresh your main page (or visit any random page) and you should see a “chat” tab at the top.

Click the button to start chatting with your MediaWiki users. There are some optional parameters which can be defined in your LocalSettings.php file to disable anonymous chat access and more.

How To Disable Chat For Anonymous Users?

By default, Anonymous users may access chatroom and assume the nickname ‘Guest’. You can disable this and deny access to anonymous users by changing the appropriate define statements at the top of WikiChat.php file:

define('WC_ALLOW_ANONYMOUS_USERS', false);

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

How To Make All Tabs Use One MediaWiki Chatroom?

By default each article uses a new chatroom with the name of the article as the title of the chatroom. This is set by defining WC_ROOM_PER_ARTICLE to true in WikiChat.php file.

To point all chats to one chatroom simply change it to false as shown here:

define('WC_ROOM_PER_ARTICLE', false);

This will now put users entering through the chat tab to single site-wide chatroom on your MediaWiki website.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.