News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

FlashChat Integration

Started by Tyrsson, January 05, 2007, 03:44:53 AM

Previous topic - Next topic

Tyrsson

Link to Mod | Rate this Mod | Puchase FlashChat
FlashChat Integration

Version 1.0 released! Note that if you had version 0.1 installed, you will NEED to uninstall it before installing the new version!

This mod will seamlessly integrate FlashChat into your SMF installation. It adds a 'Chat' link to the top menu, and users that are logged in to the chat appear under Users Online as "Users currently in chat" (and optionally at the top of the forum). This mod also fixes a small bug in FlashChat :)

Screenshots of it in action
The main chat window (click for larger view):



Settings:



"Users Online" display:




Prerequisites
You must have already purchased and installed FlashChat into the chat directory (as per the instructions for integrating with SMF), and it must be working. Also note that you do not need to edit the Themes/default/index.template.php file to add a button (like the instructions say to), as this mod does that automatically.
FlashChat can be purchased from http://www.tufat.com/s_flash_chat_chatroom.htm

Support
Support for this mod is given in my forum, at http://www.daniel15.com/.
Note that I do not provide support for FlashChat, that is up to http://www.tufat.com/! I just provide support for this mod.

NOTE: For anyone with the 'Googlebot and Spiders' mod installed, you may install this mod, but two of the edits (SSI.php and BoardIndex.template.php) will fail (due to both the Googlebot and Spiders mod and this mod editing the same code). You may continue to install this mod (it will install successfully), but please see this post for what to do after installation.
Edit: This is currently NOT up-to-date. Please check back later for updated instructions on installing this mod alongside the Googlebot mod!

Theme Changes
Please see http://www.daniel15.com/forum/index.php/topic,856.html for the theme changes required to support this mod.

Changelog
1.0 (Final)
-----------

       
  • Several new features:

               
    • Option to open chat in new window.
    • Option to show chat seperate from forum (full-page), like standard FlashChat.
    • Option to show users in chat at top of forum.
    • Option to show number of users in chat on chat button (eg. "Chat [2 Users]").
  • A few very minor bugs (including the "logout bug") fixed

0.1 Beta
--------
Initial release (beta!)
PM at your own risk, some I answer, if they are interesting, some I ignore.

limo2005

Just what I was looking for. Only in my case I am getting :

4.     Execute Modification     ./SSI.php                                                  Test failed

6.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test failed

SMF 1.1.1 
MkPortal 1.1
Various Mods Installed
CEREBUS SKIN

Any suggestions or workaround?
I dunno!

Elegant John

I got the same errors but they were simple to fix by manually modding the effected files.

Look in install.xml to find the changes.

Works perfectly now though.

I would make the comment that more people should go the extra mile as Bloc does when he writes the manual mod instructions for his mods. Some of these here are complex and it makess it very easy to screw the pooch.

But, excellent mod

Daniel15

Sorry about the errors, the package seems to work fine on a fresh SMF installation... Do any of you have the 'Googlebot and Spiders' mod? Since both that mod and my mod edit the "Users Online" section, that's what could be causing the conflict.

QuoteI would make the comment that more people should go the extra mile as Bloc does when he writes the manual mod instructions for his mods.
In that case, I'd point you to http://server.daniel15.com/smf/package.php :D
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

macfionn

Quote from: Daniel15 on January 05, 2007, 09:22:56 PM
In that case, I'd point you to hxxp:server.daniel15.com/smf/package.php [nonactive] :D
LOL.. yeah.. I'd call that a DAMNED good tutorial. ;)  WAS very cut and dry!

Now then..ass kissing aside.. I have an issue pls. ;)

Im using a v.1.1.1 template called "Spikey" found here:  http://custom.simplemachines.org/themes/index.php?lemma=81

When you said this:
"Theme Changes
To install this on your custom theme (so it shows the users in the chat under Users Online), open Themes/[theme name]/BoardIndex.template.php"

The problem is.. on "Spikey", there isn't a BoardIndex.template.php.
Yet, even though I AM able to see who is in chat at bottom, there is no link found anywhere at the top to get to chat. 

Have any thoughts here?


Daniel15

#5
QuoteThe problem is.. on "Spikey", there isn't a BoardIndex.template.php.
Yet, even though I AM able to see who is in chat at bottom, there is no link found anywhere at the top to get to chat.
Since it doesn't have a BoardIndex.template.php, it is using the one from the default (that's why you're seeing who's in the chat)
The link for accessing the chat needs to be added to index.template.php. I'll take a look at Spikey later, and see the exact code you need.
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

texterted

Hi Daniel

Cool looking mod! I've a few problems with it tho... It installs fine on my default template 1.1.1 but I don't get any chat options in Admin. Also if I leave the chat by pressing one of my forum links I get a pop up with a 404 not found in it. Seems to be looking below the chat directory on my server.
Cheers for any input...
Eddy

Daniel15

Quote...but I don't get any chat options in Admin...
The admin panel is currently not integrated (and I'm not really sure if it can be or not, I haven't taken a look

QuoteAlso if I leave the chat by pressing one of my forum links I get a pop up with a 404 not found in it. Seems to be looking below the chat directory on my server.
I just noticed this now (it's the logout popup). I think it may be a bug in FlashChat, as I'm using the correct URL  for calling FlashChat.
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

texterted

#8
Hi Daniel
Cheers for your reply.
That's a problem with the admin then! If you integrate it into SMF then you cannot alter the chat settings from its own admin panel?? It tells you ...
"This option is not available when FlashChat is integrated with a custom CMS (content management system).
Please use the user administration tools which come with your system to add, edit, or remove users."


The 404 pop up is looking for "dologout.php" in the SMF directory not the CHAT directory... should be an easy fix? "edit... fixed this by copying the file to the parent SMF directory and editing the file to include the correct path to 'inc/common.php'.

Thanks for taking the time to do these mods on top of trying to have a life! I'm sorry to sound negative about these "bugs" but I'm needing a lot of "hand holding" here.
Cheers
Eddy

PacMan

Hello Daniel15,

I just installed the flashChat mod and everything seemed to go just fine but I have one kind of weird problem.
When I exit the mod or if I chose any other menu item I get disconnected from the chat and the closing window says OBJECT NOT FOUND in it.  Then I have to relog onto the board or the chat if I wish.

I thiink I may have a path problem but not sure, if you have any ideas I'd sure appreciate it.

My config is WindowsXp, Apache2, PHP5, Mysql5 and SMF 1.1.  I do not run IIS at all in this config.

Thanks for your efforts.  I like the mod a lot.
Mark
4 stages of manhood. 1st we belive in Santa.. 2nd we find out Santa is not real. 3rd we learn to play we are santa and 4th We suddenly look like santa! ....  :)....  Merry Christmas!

Daniel15

QuoteThat's a problem with the admin then! If you integrate it into SMF then you cannot alter the chat settings from its own admin panel?? It tells you ...
"This option is not available when FlashChat is integrated with a custom CMS (content management system).
Please use the user administration tools which come with your system to add, edit, or remove users."
That message is only for user administration in FlashChat. As all the user administration is done via SMF, you can't do it in the FlashChat admin panel. To add, remove or ban users, you use the SMF members administration.
All of the other FlashChat settings are still accessible via the FlashChat admin panel.

QuoteThe 404 pop up is looking for "dologout.php" in the SMF directory not the CHAT directory... should be an easy fix? "edit... fixed this by copying the file to the parent SMF directory and editing the file to include the correct path to 'inc/common.php'.
It may be an easy fix (I'll look in to it tommorow). The problem is that even though I'm passing the correct path to FlashChat ($boardurl/chat/), it's not respecting it for the popup. I believe I would need to either edit some of the FlashChat source (I already do a tiny bit, to fix a bug), or make it create a seperate copy of the file (like you've done).

QuoteI'm sorry to sound negative about these "bugs" but I'm needing a lot of "hand holding" here.
Nah, that's fine :D. The whole point of a beta version is to find and remove bugs ;)

QuoteWhen I exit the mod or if I chose any other menu item I get disconnected from the chat and the closing window says OBJECT NOT FOUND in it.
Yes, that's the same problem that texterted was talking about. I'll see if I can fix it soon :)

QuoteThanks for your efforts.
No problem! :D
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

texterted

Cheers for that Daniel :)

The quick fix I outlined above seems to work ok for the pop-up.
Cheers for the clarification on the Admin settings... I've got my head around it now!
I't be good if it could be integrated into SMF "Permissions" tho... so I can set which groups of forum users can access the chat.
I'd also like the chat to open in a new window. Any idea how I can accomplish this?

Thanks again for your time! :)

Daniel15

QuoteI't be good if it could be integrated into SMF "Permissions" tho... so I can set which groups of forum users can access the chat.
Ideally, that's something for the developer of FlashChat to do, as he works on the core functionality (I'd consider user access as core functionality) ;)

QuoteI'd also like the chat to open in a new window. Any idea how I can accomplish this?
In Themes/default/index.template.php, find:

// FlashChat!
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['fc_chat'] , '</a>
</td>' , $current_action == 'chat' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Replace with:

// FlashChat!
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" target="_blank">' , $txt['fc_chat'] , '</a>
</td>' , $current_action == 'chat' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


I'll probably add an option for this (choosing to open the chat in a new window) in the next release
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

texterted

Top geezer! Cheers for that  :D

texterted

In fact it'd be a good move if we could lose that log-out pop up altogether!

I really like this mod Daniel, keep up the good work!

limo2005

Quote from: Daniel15 on January 05, 2007, 09:22:56 PM
Sorry about the errors, the package seems to work fine on a fresh SMF installation... Do any of you have the 'Googlebot and Spiders' mod? Since both that mod and my mod edit the "Users Online" section, that's what could be causing the conflict.

Yes I do!  I'll do as suggested by Elegant John and see how I get on!  Best of luck with this mod and Thank You!

Limo2005
I dunno!

PacMan

Quote from: PacMan on January 06, 2007, 07:46:25 AM
Hello Daniel15,

I just installed the flashChat mod and everything seemed to go just fine but I have one kind of weird problem.
When I exit the mod or if I chose any other menu item I get disconnected from the chat and the closing window says OBJECT NOT FOUND in it.  Then I have to relog onto the board or the chat if I wish.

I thiink I may have a path problem but not sure, if you have any ideas I'd sure appreciate it.

My config is WindowsXp, Apache2, PHP5, Mysql5 and SMF 1.1.  I do not run IIS at all in this config.

Thanks for your efforts.  I like the mod a lot.
Mark

hmmmmm looks like my message (quoted here) somehow got mixed up with texterted's message above???

I'm not sure if you think you've answered it or not. lol 
Sorry but I was really lookin forward to some suggestions with this.

Thanks Daniel
Mark (Pacman) 
4 stages of manhood. 1st we belive in Santa.. 2nd we find out Santa is not real. 3rd we learn to play we are santa and 4th We suddenly look like santa! ....  :)....  Merry Christmas!

rainman

Quote from: limo2005 on January 05, 2007, 08:03:58 AM
Just what I was looking for. Only in my case I am getting :

4.     Execute Modification     ./SSI.php                                                  Test failed

6.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test failed

SMF 1.1.1 
MkPortal 1.1
Various Mods Installed
CEREBUS SKIN

Any suggestions or workaround?

I am getting the same error messages as above.
Elegant John said it was a simple fix, but I need some specific instructions on how to make this fix please.

Thanks

Edit: And yes, I have the Googlebot and Spiders installed and working.

Daniel15

QuoteIn fact it'd be a good move if we could lose that log-out pop up altogether!
Well, I should really get it working, as not using it would have one problem: If you're the last person in the chat, and you logout, you will show up on the "Users Online" as being in the chat, until someone else joins it :P

Quotehmmmmm looks like my message (quoted here) somehow got mixed up with texterted's message above???

I'm not sure if you think you've answered it or not. lol
I did answer it (I think). Your problem was the same as texterted's problem. It's a problem with FlashChat which I'll have to try and solve.

QuoteEdit: And yes, I have the Googlebot and Spiders installed and working.
I'll write how to solve this in a reply.
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Daniel15

For everyone with the Googlebot and Spiders mod, you can install this mod, but you'll need to edit two files (SSI.php and BoardIndex.template.php) manually, as both the Googlebot and Spiders mod, as well as this mod, edit the file. Here's how to edit the files:
Open SSI.php, and find:

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'] + ($modSettings['ob_googlebot_count_most_online'] ? $return['num_spiders'] : 0);

Add after:

// --- Begin FlashChat integration ---
global $boarddir, $db_name;
// Get the FlashChat database config (for the prefix)
include($boarddir . '/chat/inc/config.srv.php');
// Get the proper database prefix (including database name)
$fc_prefix = is_numeric(substr($GLOBALS['fc_config']['db']['pref'], 0, 1)) ? $db_name . '.' . $GLOBALS['fc_config']['db']['pref'] : '`' . $db_name . '`.' . $GLOBALS['fc_config']['db']['pref'];
// Load all the users currently in the chat
$result = db_query("
SELECT
fc.userid, fc.state, fc.color, fc.lang, fc.roomid,
fr.name AS roomName, fr.ispublic,
mem.realName, mem.memberName, mem.showOnline, mg.onlineColor,
mg.ID_GROUP, mg.groupName
FROM {$fc_prefix}connections AS fc
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = fc.userid)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
LEFT JOIN {$fc_prefix}rooms AS fr ON (fc.roomid = fr.id)
WHERE fc.userid IS NOT NULL
ORDER BY mem.realName ASC", __FILE__, __LINE__);

$return['users_chat'] = array();
$return['list_users_chat'] = array();
$return['num_chat'] = mysql_num_rows($result);

// Loop through all users in chat
while ($row = mysql_fetch_assoc($result))
{
// Does their membergroup have a colour?
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['userid'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['userid'] . '">' . $row['realName'] . '</a>';

// Add them to the 'Users Online' list
$return['users_chat'][$row['memberName']] = array(
'id' => $row['userid'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['userid'],
'link' => $link,
'chat' => array(
'color' => $row['color'],
'lang' => $row['lang'],
'room' => array(
'id' => $row['roomid'],
'name' => $row['roomName'],
'public' => ($row['ispublic'] == 'y' ? true : false),
),
),
);
}
mysql_free_result($result);
// --- End FlashChat integration ---

Also, find:

echo '
', (empty($return['spiders']) ? '' : $return['num_spiders'] . ' ' . ($return['num_spiders'] == 1 ? $txt['ob_googlebot_spider'] : $txt['ob_googlebot_spiders']) . ', '), $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];

Replace with:

echo '
', (empty($return['spiders']) ? '' : $return['num_spiders'] . ' ' . ($return['num_spiders'] == 1 ? $txt['ob_googlebot_spider'] : $txt['ob_googlebot_spiders']) . ', '), $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], ', ', $return['num_chat'], ' ', $return['num_chat'] == 1 ? $txt['user'] : $txt['users'], ' ', $txt['fc_in_chat'];


In Themes/default/BoardIndex.template.php, find:

echo (empty($context['spiders']) ? '' : $context['num_spiders'] . ' ' . ($context['num_spiders'] == 1 ? $txt['ob_googlebot_spider'] : $txt['ob_googlebot_spiders']) . ', '), $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];

Replace with:

echo (empty($context['spiders']) ? '' : $context['num_spiders'] . ' ' . ($context['num_spiders'] == 1 ? $txt['ob_googlebot_spider'] : $txt['ob_googlebot_spiders']) . ', '), $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'], ', ', $context['num_chat'], ' ', $context['num_chat'] == 1 ? $txt['user'] : $txt['users'], ' ', $txt['fc_in_chat'];


Also, find:

// 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']);


Add after:

// --- Begin FlashChat integration ---
// If there's users in the chat
if (!empty($context['users_chat']))
echo '
<br />
', $txt['fc_users_online'], ':<br />', implode(', ', $context['list_users_chat']);
// --- End FlashChat integration ---


Note that if you're using a custom theme, you'll need to edit that theme's BoardIndex.template.php file (eg. I applied the BoardIndex.template.php changes to my modified 'Apollo' [by Bloc] theme).
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Advertisement: