User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


Integrate phpFreeChat into Mantis

Author: Victor Boctor


A lot of open source projects use IRC for chatting and a lot of companies use some sort of Instant Messaging, which makes chatting an essential part of the software development environment. I have found IRC to be a very useful communication tool between Mantis developers, however, I found there are some issues with IRC:

  • A lot of users are not familiar with IRC.
  • In the workplace, it is common to have the IRC port blocked.
  • The IRC client is yet another tool that the person has to open and run.
  • The IRC connection sometimes keeps connecting and disconnecting and sometime it remains disconnected requiring some user interaction.

For these reasons it would be an advantage to how some sort of a web interface for chatting. The obvious options are:

  • Java IRC applet (requires JVM)
  • AJAX Chat (only a browser is required).

I've researched the available options (AJAX powered chat applications reviewed) and decided to go for phpFreeChat, however, this doesn't mean that we can not have integrate with more chat options. At the moment, no chat program will be distributed with Mantis, so integrating with another chat can be as simple as writing another recipe in the Wiki.

Integration Steps

  • Following is the directory structure on which the code sample below is based:
     chat\               # it is assumed the phpFreeChat is installed in a folder called "chat"
     mantis\             # this can be any name as long as it in the same level as phpFreeChat.
  • Install phpFreeChat and make sure it works. Make sure you make the private/public data folders writable.
  • Create the chat_page.php in Mantis root folder:
	# Mantis - a php based bugtracking system
	# Copyright (C) 2000 - 2002  Kenzaburo Ito -
	# Copyright (C) 2002 - 2006  Mantis Team   -
	# This program is distributed under the terms and conditions of the GPL
	# See the README and LICENSE files for details

	# --------------------------------------------------------
	# $Id: $
	# --------------------------------------------------------

	require_once( 'core.php' );
	access_ensure_project_level( REPORTER );   // change minimum access level if required.
	$t_chat_path = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'chat' . DIRECTORY_SEPARATOR;  // adjust to your own path
	require_once ( $t_chat_path . 'src' . DIRECTORY_SEPARATOR . 'phpfreechat.class.php' );
	$t_project_name = project_get_name( helper_get_current_project() );
	$t_nick = user_get_name( auth_get_current_user_id() );
	$params['isadmin'] = user_is_administrator( auth_get_current_user_id() ); 
	$params["serverid"] = md5( __FILE__ ); 	
	$params["title"]     = $t_project_name;
	$params["nick"]     = $t_nick;
	$params["frozen_nick"] = true;
	$params["refresh_delay"] = 5000;
	$params["clock"] = true;
	$chat = new phpFreeChat( $params );
	echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
	# uncomment the following line if you are using Mantis 1.1.0a1 or above.
	# print_recently_visited();

	echo '<br />';
	html_page_bottom1( __FILE__ );
  • Add the “Chat” option to the main menu by adding the following code to config_inc.php
	$g_main_menu_custom_options = array (
					array( "Chat", REPORTER, 'chat_page.php' )   // the access level here must match the one in chat_page.php
  • If you would like to localize the menu option then replace “Chat” with “chat” in the config_inc.php and define $s_chat based in custom_strings_inc.php based on the current language. See Customizing MantisBT section in the Admin Guide for an example of how to do this.


  • After adding this into our installation, I have seen that our apache server starts hammering on the cpu of the server once there are just 3 or 4 people using phpchat. Has there been similar observations by others?

How to clear the chat history in phpfree chat??

mantisbt/phpfreechat.txt · Last modified: 2019/01/14 06:00 by dregad