mini2
01-03-2004, 10:00 PM
This is my first hack I've shared, because it's quite generic. It's not probably quite as "complete" as it could be with forum style integration, but it works very well for what I required.
Basically I have a chat room (jirc) on my site already, but I wanted to show the number of people in the chat room, in the same way the forum home lists the number viewing each forum.
I've uploaded my jpilot files to the forum directory, and called the main chat page chat.php
You could probably integrate it better by making a new chat.php file and creating a new chat template, but I don't want my chat room to look like part of the forums, so I didn't do it that way.
The way I've dont it requires two files to be modified, and one template modified.
How I did it.
index.php I added a few small changes to get the people in the chat room counted up.
In the mysql query below "### LOGGED IN USERS ###" after "session.lastactivity," I added:
/*hack*/session.location,/*end hack*/
And below "$inforum = array();" I added:
/*hack*/
$inchat=0;
/*hack*/
Then beneath "eval('$activeusers .= ", ' . fetch_template('forumhome_loggedinuser') . '";');
} " I added:
/*hack*/
if($loggedin['location']=='/forum/chat.php'){
$inchat++;
}
/*end hack*/
In includes/functions_forumlist.php below "### Start makeforumbit ###" I added:
/*hack*/
global $inchat;
/*end hack*/
That's it for file mods.
Then in forumhome_forumbit_level2_post under:
<if condition="$show['browsers']">
<span class="smallfont">
(<phrase 1="$forum[browsers]">$vbphrase[x_viewing]</phrase>)
</span>
</if>
I added:
<if condition="$forum[forumid]==628 AND $inchat!=0">
<span class="smallfont">($inchat in Chat)</span>
</if>":
If you do this, replace the value for forumid with whatever id the forum has you use.
The forum must be added as a "link" forum to the chat room URL (chat.php) for it to show in the forum list.
As I say, there's probably other ways of doing this, and I've no real intention just now of upgrading this, but it works nicely.
Attached is a small screen shot of the chat room listing on the forumhome...
Basically I have a chat room (jirc) on my site already, but I wanted to show the number of people in the chat room, in the same way the forum home lists the number viewing each forum.
I've uploaded my jpilot files to the forum directory, and called the main chat page chat.php
You could probably integrate it better by making a new chat.php file and creating a new chat template, but I don't want my chat room to look like part of the forums, so I didn't do it that way.
The way I've dont it requires two files to be modified, and one template modified.
How I did it.
index.php I added a few small changes to get the people in the chat room counted up.
In the mysql query below "### LOGGED IN USERS ###" after "session.lastactivity," I added:
/*hack*/session.location,/*end hack*/
And below "$inforum = array();" I added:
/*hack*/
$inchat=0;
/*hack*/
Then beneath "eval('$activeusers .= ", ' . fetch_template('forumhome_loggedinuser') . '";');
} " I added:
/*hack*/
if($loggedin['location']=='/forum/chat.php'){
$inchat++;
}
/*end hack*/
In includes/functions_forumlist.php below "### Start makeforumbit ###" I added:
/*hack*/
global $inchat;
/*end hack*/
That's it for file mods.
Then in forumhome_forumbit_level2_post under:
<if condition="$show['browsers']">
<span class="smallfont">
(<phrase 1="$forum[browsers]">$vbphrase[x_viewing]</phrase>)
</span>
</if>
I added:
<if condition="$forum[forumid]==628 AND $inchat!=0">
<span class="smallfont">($inchat in Chat)</span>
</if>":
If you do this, replace the value for forumid with whatever id the forum has you use.
The forum must be added as a "link" forum to the chat room URL (chat.php) for it to show in the forum list.
As I say, there's probably other ways of doing this, and I've no real intention just now of upgrading this, but it works nicely.
Attached is a small screen shot of the chat room listing on the forumhome...