Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2001
Posts: 96
Power User
Power User
Joined: Apr 2001
Posts: 96

Has anyone figured out how to add a "Who's Chatting" custom island into Threads?

Edit: Never mind, I found this download (just a php file) in the Tufat resources: New "Who's Chatting" file for CMS systems cool

Edit Again: Haven't gotten it working in a custom island yet, but it works as a stand-alone page. Getting errors when put in a custom island. Here's the code...

PHP Code

/* PHP CODE HERE, IF NECESSARY */

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");


/**
If this file is not in the FlashChat root folder, then change this
path to the location of the inc/common.php file.
*/
include_once('inc/common.php');

ChatServer::purgeExpired(); // ERROR HERE: Undefined class name 'chatserver'

/**
Retrieves the number of users who are chatting in any room.
Leave the $room parameter empty to return the number of users in all room.
*/
function numusers( $room = "" )
{
if(
$room) {
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND roomid=?");
$rs = $stmt->process($room);
} else {
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections,{$GLOBALS['fc_config']['db']['pref']}rooms
WHERE userid IS NOT NULL AND ispublic IS NOT NULL
AND
{$GLOBALS['fc_config']['db']['pref']}connections.roomid = {$GLOBALS['fc_config']['db']['pref']}rooms.id");
$rs = $stmt->process();
}

$rec = $rs->next();

return
$rec?$rec['numb']:0;
}

/**
Retrieves a list of the users (by login ID) who are in $room.
Leave the $room parameter empty to return a list of all users in all rooms.
*/
function usersinroom( $room = "" )
{
$cms = $GLOBALS['fc_config']['cms'];
$list = array();

if(
$room) {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND roomid=?");
$rs = $stmt->process($room);
} else {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL");
$rs = $stmt->process();
}

while(
$rec = $rs->next()) $list[] = array_merge($cms->getUser($rec['userid']), $rec);

return
$list;
}

/**
Retrieves a list of all available rooms, as an array.
*/
function roomlist()
{
$list = array();

// populate $list with the names of all available rooms
$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NOT NULL order by ispermanent");
$rs = $stmt->process(); // ERROR: Cannot instantiate non-existent class: statement

while($rec = $rs->next()) $list[] = $rec;

//result will be an array of arrays like ('id' => <room id>, 'updated' = <timestamp>, 'created' => <timestamp>, 'name' => <room name>, 'ispublic' => <public flag>, 'ispermanent' => <autoclose flag>)
return $list;
}


$rooms = roomlist();
$roomnumb = sizeof($rooms);
$usernumb = numusers();



/* DO NOT CHANGE THE LINE BELOW */
$body = <<<EOF

<BR>&#62;<a href="/threads/chat/flashchat.php" target="_blank">Chatroom</a> (<?=
$usernumb ?> user<? if ($usernumb != 1) echo "s" ?> in <?=$roomnumb ?> room<? if ($roomnumb != 1) echo "s"; ?>)
<ul id="roomList">
<?php if(
$roomnumb) { ?>
<?php foreach(
$rooms as $room) { ?>
<li><strong><a href="#" onclick="javascript:toggleUserList('room_<?=
$room[id]?>')"><?=$room[name]?> (<?= numusers($room[id]) ?>)</a></strong>
<?php
$users = usersinroom($room[id]);
if (
$users) {
echo "<ul class="userList" id="room_".
$room[id]."">";
foreach(
$users as $user ) {
echo "<li>".
$user[login] . "</li>";
}
echo "</ul>";
}

?> </li>
<?php } ?>
<?php } ?>
</ul>



EOF;
/* DO NOT CHANGE THE LINE ABOVE */


Last edited by jgeoff; 02/19/2008 7:10 PM. Reason: Ugh

GangsterBB.NET (Ver. 7.3)
2007 Content Rulez Contest - Honorable Mention
UBB.classic 6.7.2 - RIP
Browser: Firefox 2.0
Sponsored Links
Entire Thread
Subject Posted By Posted
FlashChat with UBB.Threads 7.0.2 greenfirefly 12/19/2006 1:00 AM
Re: FlashChat with UBB.Threads 7.0.2 AllenAyres 12/21/2006 10:20 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 12/22/2006 2:23 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/02/2007 3:59 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/03/2007 1:54 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/03/2007 3:03 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/03/2007 5:16 AM
Re: FlashChat with UBB.Threads 7.0.2 owen93 03/06/2007 3:52 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/06/2007 5:36 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/06/2007 5:44 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 7:46 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 7:47 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 8:09 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 8:40 PM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/06/2007 9:28 PM
Re: FlashChat with UBB.Threads 7.0.2 owen93 03/06/2007 11:25 PM
Re: FlashChat with UBB.Threads 7.0.2 blaaskaak 03/07/2007 1:09 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/07/2007 1:33 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/07/2007 3:10 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/07/2007 3:45 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/07/2007 4:45 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/08/2007 4:33 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/08/2007 6:49 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/08/2007 9:12 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/08/2007 9:43 PM
Re: FlashChat with UBB.Threads 7.0.2 owen93 03/09/2007 1:07 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/09/2007 1:47 AM
Re: FlashChat with UBB.Threads 7.0.2 Daryl Fawcett 03/09/2007 4:44 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/18/2007 9:46 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/21/2007 7:29 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/22/2007 12:15 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/22/2007 1:01 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/22/2007 1:12 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/22/2007 1:15 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/22/2007 8:08 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/23/2007 12:33 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 03/23/2007 2:05 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 03/23/2007 5:45 AM
Re: FlashChat with UBB.Threads 7.0.2 Calpy 05/13/2007 4:28 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 05/13/2007 6:13 AM
Re: FlashChat w UBBT7.1 fixed login name issue Calpy 05/13/2007 10:33 AM
Re: FlashChat with UBB.Threads 7.0.2 Calpy 05/14/2007 11:41 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/12/2007 10:00 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/13/2007 9:48 PM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/13/2007 11:44 PM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 07/14/2007 1:34 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/14/2007 9:47 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 07/14/2007 10:29 AM
Re: FlashChat with UBB.Threads 7.0.2 sirdude 07/14/2007 10:37 AM
Re: FlashChat with UBB.Threads 7.0.2 Gizmo 07/14/2007 11:57 AM
Re: FlashChat with UBB.Threads 7.0.2 jgeoff 07/14/2007 8:21 PM
Re: FlashChat with UBB.Threads 7.1 jgeoff 02/20/2008 12:12 AM
Re: FlashChat with UBB.Threads 7.1 jgeoff 02/20/2008 1:14 AM
Re: FlashChat with UBB.Threads 7.1 curiousguy 02/22/2008 3:58 PM
Re: FlashChat with UBB.Threads 7.1 DarylCA 02/22/2008 4:16 PM
Chat integration will work with upgrades? curiousguy 02/22/2008 4:45 PM
Re: Chat integration will work with upgrades? jgeoff 02/22/2008 9:41 PM
Re: Chat integration will work with upgrades? Gizmo 02/23/2008 1:43 AM
Re: Chat integration will work with upgrades? Dslam 02/24/2008 2:56 AM
Re: Chat integration will work with upgrades? Dslam 02/24/2008 3:21 AM
Re: Chat integration will work with upgrades? jgeoff 05/12/2008 11:39 PM
Re: Chat integration will work with upgrades? SteveS 07/07/2008 5:37 PM
Re: Chat integration will work with upgrades? Gizmo 07/08/2008 7:30 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)