From FUDforum Wiki
Jump to: navigation, search

This article describes how phpFreeChat can be integrated into a FUDforum site. The code below will automatically set the phpFreeChat nickname to your FUDforum userid.

phpFreeChat changes

You have to put this piece of code at beginning of your phpFreeChat chat script (index.php):

$fuduser = ses_get();
if ($fuduser->alias == $ANON_NICK)
      $fuduser->alias = 'guest'.rand(1,1000); // generate random nick for guest

Then you can replace the classic phpFreeChat parameter list (same file, top) using $fuduser->alias as the phpfreechat nickname. For example:

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params["serverid"]             = md5(__FILE__);
$params["title"]                = "FUDforum chat";
$params["channels"]             = array("FUDforum support", "General chitchat");
$params["language"]             = "en_US";
$params["nick"]                 = $fuduser->alias;
$params["start_minimized"]      = true;
$chat = new phpFreeChat( $params );

FUDforum changes

Add the phpFreeChat code to your FUDforum template (either header.tmpl or footer.tmpl) and rebuild your theme when done.

External links

Personal tools