Advertisement:

Author Topic: phpFreeChat [Solved]  (Read 10280 times)

Offline gsizer

  • Newbie
  • *
  • Posts: 4
phpFreeChat [Solved]
« on: December 09, 2008, 10:11:07 PM »
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?
« Last Edit: December 14, 2008, 01:38:36 PM by gsizer »

Offline gsizer

  • Newbie
  • *
  • Posts: 4
Re: phpFreeChat
« Reply #1 on: December 10, 2008, 12:05:45 AM »
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?

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,868
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: phpFreeChat
« Reply #2 on: December 13, 2008, 05:14:45 PM »
index.php

Find
Code: [Select]
'calendar' => array('Calendar.php', 'CalendarMain'),
Add after that
Code: [Select]
'chat' => array('Chat.php', 'Chat'),
Save the changes and upload the modified index.php to your forum directory, overwriting the existing one.
Michael Eshom
Cincy Space - now open!

Offline gsizer

  • Newbie
  • *
  • Posts: 4
Re: phpFreeChat
« Reply #3 on: December 14, 2008, 01:37:33 PM »
thanks you so much for that. i completely missed that whole array. big hugs for you!