phpFreeChat [Solved]

Started by gsizer, December 09, 2008, 10:11:07 PM

Previous topic - Next topic

gsizer

Hello all,
Am using 2.0b4 and was wondering if anyone has yet figured out how to integrate phpFreeChat using member login as nick in chat.
i tried just using my old script from the 1.1.7SMF, but that's a big nogo... spits out a bunch of forum not found errors along with the base <div>frame of the actual chat page.

Any ideas how i might go about fixing this?

gsizer

ok.. i think i almost figured it out. i read through the modification how-to for 2.0.. well whats there anyway.
Code (Button Code in Subs.php inside Sources folder) Select

'chat' => array(
         'title' => "Member Chat",
         'href' => $scripturl . '?action=chat',
         'show' => !$user_info['is_guest'],
         ),


The setup of the chatroom variables:
Code (Chat.php inside Sources directory) Select

<?php
// If not called by SMF, it's bad!
if (!defined('SMF'))
   die(
'Hacking attempt...');

function 
Chat()
{
   global 
$context$user_info$chat;
   
   
// They're a guest? Don't let them in!
   
is_not_guest('Sorry, you can not enter the chat room!');
   
   require_once (
dirname)."/../pfc/src/phpfreechat.class.php";

   
$params = array();
   
$params['serverid'] = md5(__FILE__);
   
$params['title'] = 'TheSizer.net Chat';
   
$params['nick'] = $user_info['name'];
   
$params['admins'] = array('USERNAME' => 'PASSWORD');
   
$params['frozen_nick'] = true;
   
$params['height'] = '300';
   
$params['clock'] = false;
   
$params['btn_sh_whosonline'] = false;
   
$params['nickname_colorlist'] = array('#f00','#0f0','#00f','#909','#099');
   
$params['channels'] = array('TechSupport','Games','Commons');

   
$chat = new phpFreeChat($params);

   
$context['html_headers'] .= $chat->printJavascript(true);
   
$context['html_headers'] .= $chat->printStyle(true);

   
$context['sub_template'] = 'chat';
   
$context['page_title'] = 'Chat - '.$context['forum_name'];
   
   
loadTemplate('Chat');
}

?>



Code (Chat.Template.php inside default theme folder) Select

<?php

function template_chat()
{
   global 
$user_info$context$chat;

   
$chat->printChat();
}
?>



And for all that work, i get redirected to the forum index. Anyone have an idea?

Oldiesmann

index.php

Find
'calendar' => array('Calendar.php', 'CalendarMain'),

Add after that
'chat' => array('Chat.php', 'Chat'),

Save the changes and upload the modified index.php to your forum directory, overwriting the existing one.
Michael Eshom
Christian Metal Fans

gsizer

thanks you so much for that. i completely missed that whole array. big hugs for you!

Advertisement: