Reply to comment

Show number of users in chat...

Hi - I am trying to add to your plugin to show the number of users in chat next to the chat icon.
I am finding people don['t enter chat unless they see activity.
I am attempting to mod the code posted in this thread: http://www.phpbb.com/community/viewtopic.php?f=71&t=1411395&start=15

start at the 3rd or 4th entry down.

I can't seem to get the code to properly count users in chat... my demo code is as follows:

<?php

require_once "pfc/src/pfcinfo.class.php";
$info = new pfcInfo( md5("phpfreechat") );
// NULL is used to get all the connected users, but you can specify
// a channel name to get only the connected user on a specific channel
$users = $info->getOnlineNick($channel = NULL);

$info = "";
$number = count($users);
if ($number == 1) {
$info = "$number user in chatroom ";
} else {
$info = "$number users in chatroom "; }
$in_chat = $in_chat . sprintf($info, $number);
foreach($users as $name)
{

if ($counter == 0) { $comma = ": ";}
if ($counter > 0) { $comma = ", "; }
$counter++;
$in_chat = $in_chat . $comma . $name ;
}
echo $in_chat;
echo $number;
?>

code is placed in: /mod/chat/showonline.php

I put the echo statements in to see if values are indeed changing... and they are not.

Any thoughts?

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options