Mr_Bob |
04-24-2005 02:27 PM |
Quote:
Originally Posted by Paul M
The upgrade was nothing to do with any version of Flashchat, it was an alteration to take account of the displaygroupid in vB.
However, this hack works perfectly for Flashchat 4.0.0 (beta) - I have been running this version of the chat on our forum for 2/3 weeks now, so you must have made a mistake somewhere.
|
I must, however FlashChat came out of beta on the 21. It worked well when I was working with the beta, but not now. I'll post up part of my index.php file and forumhome template
PHP Code:
}
// ############# Paul M - Flashchat - Who is in the chat v2.00 ###############
$chatlist = $DB_site->query("SELECT connections.userid, connections.roomid, rooms.name, rooms.ispublic, connections.start,
user.usergroupid, user.displaygroupid, user.options, user.username, groupa.opentag as opentaga, groupa.closetag as closetaga,
groupb.opentag as opentagb, groupb.closetag as closetagb
FROM " . TABLE_PREFIX . "connections as connections
LEFT JOIN " . TABLE_PREFIX . "rooms as rooms ON(connections.roomid = rooms.id)
LEFT JOIN " . TABLE_PREFIX . "user as user ON(connections.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupa ON(user.usergroupid = groupa.usergroupid)
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupb ON(user.displaygroupid = groupb.usergroupid)
WHERE connections.userid IS NOT NULL ORDER BY start" );
unset($chatters);
$totalchatters = 0;
while ($chat = $DB_site->fetch_array($chatlist))
{
$totalchatters += 1;
$roomname = "In private room";
$chat['opentag'] = $chat['opentaga'] ;
$chat['closetag'] = $chat['closetaga'] ;
if ($chat['displaygroupid'])
{
$chat['opentag'] = $chat['opentagb'] ;
$chat['closetag'] = $chat['closetagb'] ;
}
if ($chat['ispublic']) { $roomname = "In ".$chat['name']; }
$chatters .= "<a href='member.php?u=$chat[userid]' title=\"$roomname\" >";
$chatters .= $chat['opentag'].$chat['username'].$chat['closetag']."</a>, ";
}
if ($chatters)
{
$chatters = substr($chatters, 0, strlen($chatters)-2);
}
else
{
$chatters = "No one is currently using the chat";
}
// ############# End of Who is in the chat ###############
// ### LOGGED IN USERS #################################################
$activeusers = '';
if ($vboptions['displayloggedin'])
{
$datecut = TIMENOW - $vboptions['cookietimeout'];
$numbervisible = 0;
$numberregistered = 0;
$numberguest = 0;
$forumusers = $DB_site->query("
SELECT
user.username, (user.options & $_USEROPTIONS[invisible]) AS invisible, user.usergroupid,
session.userid, session.inforum, session.lastactivity,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " . TABLE_PREFIX . "session AS session
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)
WHERE session.lastactivity > $datecut
" . iif($vboptions['displayloggedin'] == 1, "ORDER BY username ASC") . "
");
if ($bbuserinfo['userid'])
{
// fakes the user being online for an initial page view of index.php
$bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']);
$userinfos = array
(
$bbuserinfo['userid'] => array
(
'userid' => $bbuserinfo['userid'],
'username' => $bbuserinfo['username'],
'invisible' => $bbuserinfo['invisible'],
'inforum' => 0,
'lastactivity' => TIMENOW,
'usergroupid' => $bbuserinfo['usergroupid'],
'displaygroupid' => $bbuserinfo['displaygroupid'],
)
);
}
else
{
$userinfos = array();
}
$inforum = array();
while ($loggedin = $DB_site->fetch_array($forumusers))
{
$userid = $loggedin['userid'];
if (!$userid)
{ // Guest
$numberguest++;
$inforum["$loggedin[inforum]"]++;
}
else if (empty($userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity']))
{
$userinfos["$userid"] = $loggedin;
}
}
foreach($userinfos AS $userid => $loggedin)
{
$numberregistered++;
if ($userid != $bbuserinfo['userid'])
{
$inforum["$loggedin[inforum]"]++;
}
$loggedin['musername'] = fetch_musername($loggedin);
if (fetch_online_status($loggedin))
{
$numbervisible++;
eval('$activeusers .= ", ' . fetch_template('forumhome_loggedinuser') . '";');
}
}
// memory saving
unset($userinfos, $loggedin);
$activeusers = substr($activeusers , 2); // get rid of initial comma
$DB_site->free_result($loggedins);
$totalonline = $numberregistered + $numberguest;
$numberinvisible = $numberregistered - $numbervisible;
// ### MAX LOGGEDIN USERS ################################
$maxusers = unserialize($datastore['maxloggedin']);
if (intval($maxusers['maxonline']) <= $totalonline)
{
$maxusers['maxonline'] = $totalonline;
$maxusers['maxonlinedate'] = TIMENOW;
build_datastore('maxloggedin', serialize($maxusers));
}
$recordusers = $maxusers['maxonline'];
$recorddate = vbdate($vboptions['dateformat'], $maxusers['maxonlinedate'], true);
$recordtime = vbdate($vboptions['timeformat'], $maxusers['maxonlinedate']);
$show['loggedinusers'] = true;
}
else
{
$show['loggedinusers'] = false;
}
// ### GET FORUMS & MODERATOR iCACHES ########################
cache_ordered_forums(1);
if ($vboptions['showmoderatorcolumn'])
{
cache_moderators();
}
else
{
$imodcache = array();
$mod = array();
}
// define max depth for forums display based on $vboptions[forumhomedepth]
define('MAXFORUMDEPTH', $vboptions['forumhomedepth']);
$forumbits = construct_forum_bit($forumid);
Also here is the portion of my forumhome template:
Code:
<!-- end logged-in users -->
<!-- who's in flashchat -->
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_chatusers')"><img id="collapseimg_forumhome_chatusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_chatusers].gif" alt="" border="0" /></a>
Members currently in the Chat: $totalchatters
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_chatusers" style="$vbcollapse[collapseobj_forumhome_chatusers]">
<tr>
<td class="alt2"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="Users online today" border="0" /></td>
<td class="alt1" width="100%"><div class="smallfont">$chatters</div></td>
</tr>
</tbody>
<!-- end who's in flashchat -->
</if>
<tbody>
Hope you can help me out, this is a great hack I won't give up on without a fight :).
|