Tutorial: how to COMPLETELY integrate FlashChat into SMF so you have a cool CHAT

Started by marcnyc, October 09, 2004, 07:21:56 AM

Previous topic - Next topic

snork13

Quote from: rendi on December 29, 2005, 11:41:44 PM
same with me i'm use SMF 1.1 RC1 too  :-*

the tutorial need to be updated for 1.1, but it will work...basic...add another tr, and td for he flash chat..i'll see if i can write something tom..i'm so busy
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

nightdreamer

I have entered the line as stated and uploaded the chat gif to the image file.. The chat icon is not being displayed on the Bar my Flashchat is in a Different folder than the recommended folder as i downloaded flashchat before i downloaded the blog program.

can you see my chatblog and tell me where im going wrong please..
I would be very greatful

http://www.nightdreamer2000.com/smf_1-0-5_install/index.php [nofollow]

Simplemachines Cowboy

#202
Boardindex.template.php 1.1rc1 default template

Make sure you replace "YOUR DATABASE _fc_connections HERE" with your correct mysql path.

// "Users online" - in order of activity.

    $chatrequest = db_query("
            SELECT COUNT(*) AS numb
            FROM  YOUR DATABASE _fc_connections HERE
            WHERE userid IS NOT NULL", __FILE__, __LINE__);
         list ($chatcount) = mysql_fetch_row($chatrequest);   
         mysql_free_result($chatrequest);
     
if ( $chatcount == "1" ) {
$singularplural2 = "";
} else {
$singularplural2 = "s";
}
   
echo '
<tr>
<td class="catbg" colspan="2">', $txt[158], '</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', '<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt[158], '" border="0" />', $context['show_who'] ? '</a>' : '', '
</td>
<td class="windowbg2" width="100%">';

if ($context['show_who'])
echo '
<a href="', $scripturl, '?action=who">', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'], (empty($context['num_users_hidden']) ? '' : ' (' . $context['num_users_hidden'] . ' ' . $txt['hidden'] . ')'), ', ' . $chatcount . ' User'.$singularplural2.' in Chat</a><br />';

echo '
<div class="smalltext">';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
echo '
', $txt[140], ':<br />', implode(', ', $context['list_users_online']);

echo '
<br />', $context['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>
</td>
</tr>';

// flashchat users
echo '
<tr>
<td class="catbg" colspan="2">Flashchat Users</td>
</tr>
<tr>
<td class="windowbg">&nbsp;</td>
<td class="windowbg2" width="100%"><iframe frameborder="0" height="100" src="', $GLOBALS['boardurl'], '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" allowtransparency="true"></iframe></td>
</tr>';

// If they are logged in, but SP1 style information is off... show a personal message bar.
if ($context['user']['is_logged'] && !$settings['show_sp1_info'])
{
echo '
<tr>
<td class="catbg" colspan="2">', $txt[159], '</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
', $context['allow_pm'] ? '<a href="' . $scripturl . '?action=pm">' : '', '<img src="', $settings['images_url'], '/message_sm.gif" alt="', $txt[159], '" border="0" />', $context['allow_pm'] ? '</a>' : '', '
</td>
<td class="windowbg2" valign="top">
<b><a href="', $scripturl, '?action=pm">', $txt[159], '</a></b>
<div class="smalltext">
', $txt[660], ' ', $context['user']['messages'], ' ', $context['user']['messages'] == 1 ? $txt[471] : $txt[153], '.... ', $txt[661], ' <a href="', $scripturl, '?action=pm">', $txt[662], '</a> ', $txt[663], '
</div>
</td>
</tr>';
}

// Show the login bar. (it's only true if they are logged out anyway.)
My SMF forum: The Open Range

Simplemachines Cowboy

#203
Index.template.php 1.1 rc1 default template
THe first part will put the users in flashchat above the buttons and aligned left, with the search bar on the same level but aligned right.
<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>
<td align="left">', template_flash_chat(), '</td>
<td align="right">
<form action="', $scripturl, '?action=search2" method="post" style="margin: 0;">
<div style="margin-top: 7px;">
<b>', $txt[182], ': </b><input type="text" name="search" value="" style="width: 190px;" />&nbsp;
<input type="submit" name="submit" value="', $txt[182], '" style="width: 8ex;" />&nbsp;
<a href="', $scripturl, '?action=search;advanced">', $txt['smf298'], '</a>
<input type="hidden" name="advanced" value="0" />';

// If we're on a certain board, limit it to this board ;).


Make sure you replace "YOUR DATABASE _fc_connections HERE" with your correct mysql path.
// Otherwise, they might want to [logout]...
else {
     echo '<a href="', $scripturl, '?action=chat" target="_blank">',
     ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
     . '/chat.gif" alt="FlashChat" style="margin: 2px 0;"
     border="0" />' : "FlashChat"),'</a>';

    echo '&nbsp;<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
    '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
    . '" style="margin: 2px 0;" border="0" />' : $txt[108]),'</a>';
}
}

function template_flash_chat()
{
// Flashchat Users
$chatrequest = db_query("
            SELECT COUNT(*) AS numb
            FROM  YOUR DATABASE _fc_connections HERE
            WHERE userid IS NOT NULL", __FILE__, __LINE__);
        list ($chatcount) = mysql_fetch_row($chatrequest);   
        mysql_free_result($chatrequest);
if ( @$_GET['action'] != "chat" ) {
if ( $chatcount == "1" ) {
$singularplural1 = " is ";
$singularplural2 = "";
} else {
$singularplural1 = " are ";
$singularplural2 = "s";
}
return 'Currently there ' . $singularplural1 . ' <font color="#FF0000">' . $chatcount . ' User'.$singularplural2.' in the Chat!</font><br/>';
}
}
?>
My SMF forum: The Open Range


nightdreamer

I am trying my Hardest to get the Flaschat working Via the Fourm Boar Chat icon My flashchat is in a Serperate folder to SMF.. and i keep getting this Error....

2: smf_main(/home/content/n/i/g/nightdreamer/html/smf_1-0-5_install/Sources/Chat.php): failed to open stream: No such file or directory
File: /home/content/n/i/g/nightdreamer/html/smf_1-0-5_install/index.php
Line: 318


Also do i need to alter the Following......

'chat' => array('Chat.php', 'Chat'),

and also This section...

<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
         <tr class="titlebg">
            <td>Chat</td>
         </tr><tr>
            <td class="windowbg">';

               // load the chat
               echo '<iframe width="100%" height="450" src="http://www.nightdreamer2000.com/chat/flashchat.php [nofollow]"></iframe>';


I would be very Greatful if you could help me as i dont really want to start Deleting a Folder just to upload it to the SMF or Vice versa

Simplemachines Cowboy

No, what I posted is for 1.1 rc1.
I will have a new tutorial for rc2 shortly.
My SMF forum: The Open Range

Chucky

I can't figure out how to show "users in chat" with SMF 1.0.5. Any ideas?

psychophat

I want this integration but I'll wait for your 1.1 RC2 tutorial. ;) wink*
I adore this forum, from zero PHP knowledge to +.1% per post
I'm going to get the charter member thinggy when I get to save some cash
SMF v.1.1RC2
PHP v.4.3.11

Uzbekistan

Here is mine if it's of any help:

Steps 1-7 are the same as of the 1st post.

Step 8: In you language files in index.yourlanguage.php at the end (before php closing bracket "?>") add the following line:

$txt['chat_but'] = 'Chat In Your language';

Step 9: Find this code:
// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
</td>' , $current_action == 'register' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


After it add this one:
// chat code by UzForum.Com
if ($context['user']['is_logged'])
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=chat">' , $txt['chat_but'] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


It adds a link in the top menu. However there is a glitch - on the home page both Home & Chat are highlighted as active (other pages are normal), i didn't have a time to see what's wrong. It works though...

Simplemachines Cowboy

You are close:
You still have action=='home' in your code. Change it to 'chat'
// Show the [chat] button.
if ($context['user']['is_logged'])
echo ($current_action=='chat' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'chat' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=chat">' , $txt['chat_1'] , '</a>
</td>' , $current_action == 'chat' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


And don't forget to add chat to the action menu
Find in index.template.php
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))

As you can see it has a list of the actions in the menu.  What we are going to do is add , 'chat' after 'pm'.  Each action in the array is separated by a comma and enclosed in single quotes (').

It should look like this.
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'chat')))
My SMF forum: The Open Range

Uzbekistan

My respect :), I am not a coder though. I thought that "action" thing tells on "Whos online" who's doing what & where, so i wasn't sure. Now we need to integrate that thingy in the bottom showing users in the chat. ;).

Simplemachines Cowboy

Here is the complete tutorial for RC2 and the default theme:

http://www.simplemachines.org/community/index.php?topic=66561.0

Plese let me know if you come across any errors!
My SMF forum: The Open Range

jiminoregon

Quote from: Owdy on October 31, 2004, 12:27:21 PM
How to ad list of users who are in chat

In /FlashChat/info.php, find:

<html>
<title>Who's in the chat?</title>
<head>
<style type="text/css">
<!--
.normal {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
A {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #0000FF;
}
A:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FF0000;
}
-->
</style>
</head>
<body>
<center>
<p class=normal>There are <?=numusers()?> users in <?=$roomnumb?> rooms.</p>
<?php if($roomnumb) { ?>
<table border="1" cellpadding="1" class="normal">
<tr>
<th>ID</th>
<th>Name</th>
<th>Count</th>
<th>Users</th>
</tr>
<?php foreach($rooms as $room) { ?>
<tr>
<td><?=$room['id']?></td>
<td><?=$room['name']?></td>
<td><?=numusers($room['id'])?></td>
<td><?php

$users usersinroom($room['id']);

foreach( $users as $user ) {
echo $user['login'] . "<br>";
}

?>
</td>
</tr>
<?php ?>
</table>
<?php ?>

<p><a href="javascript:window.close()">Close</a></p>
<center>
</body>
</html>


Replace:

<span style="font-size:xx-small;color:#0232a1">
<?php

$users usersinroom($room['id']);

foreach( $users as $user ) {
echo $user['login'] . ",";
}

?>
</span>



then ad this in index.template.php:

<td colspan="2">
';
if ($context['user']['is_logged'])
echo '
<font size="-2">Users in chat:</font> ';
if ($context['user']['is_logged'])
{

readfile("http://www.example.com/FlashChat/info.php");
}
echo ' 



</td>
With this code only logged users see that list.  Code may be crappy (PHP N00b here), but it works.

I know this is a dumb, simple question, but I can't figure it out.  Is there a way to have a title in front of the displayed names, such as "Who's in Chat"?

Thanks...Jim

The pic is what the display shows now:

dguywill

Greetings,
I have been working on integrating FlashChat and SMF 1.1 R1 using the following guide:
http://www.simplemachines.org/community/index.php?topic=27137.0
However, on part 4 I am unable to find this line of code:

<a href="', $scripturl, '?action=who">', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'], (empty($context['num_users_hidden']) ? '' : ' (' . $context['num_users_hidden'] . ' ' . $txt['hidden'] . ')'), '</a><br />

which should be replaced by:

<a href="', $scripturl, '?action=who">', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'], (empty($context['num_users_hidden']) ? '' : ' (' . $context['num_users_hidden'] . ' ' . $txt['hidden'] . ')'), ', ' . $chatcount . ' User'.$singularplural2.' in Chat</a><br />
Can anyone help me with this problem please.

Thanks in advance,
Dee.

dguywill

In addition to my previous post, I am getting the following error when I click on the chat button:

Fatal error: smf_main() [function.require]: Failed opening required '/home/sierrale/public_html/forum/Sources/Chat.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/sierrale/public_html/forum/index.php on line 337

Any help will be greatly appreciated.

Thanks,
Dee.

dracomiconia

Problems with 1.0.6

Some users seems to be banned, but others, not.

Simplemachines Cowboy

Search for this on the flashchat forum.
The answer is there; several other smf users found it.
http://www.tufat.com/forum/index.php
My SMF forum: The Open Range

CLICKBANKS.NET

Hi! how can I made "Currently there are 1 Users in the Chat!" this to show on my board (SMF 1.0.6) in default templates? Thanks

raiwatson

2: call_user_func(ChatRoom): First argument is expected to be a valid callback
File: /home/secureo/public_html/smf/index.php
Line: 119


This is the error message I get when I click on my chat button.  Any idea what I might have done wrong?  (I haven't moved on to the 2nd part of the tutorial - only gone through Step 8 so far.)  I'm using smf 1.0.6 with the classic theme.

http://www.secureoffsite.com/smf/index.php

Advertisement: