Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Mod Name / Version: Show Users In Chat 1.0

Description: This adds a box to the top of each page announcing how many people are in your chat room. This encourages use of the chatroom.

Working Under: UBB.Threads 6.2-6.3

Mod Status: Beta

Any pre-requisites: One of the Chat Integration Mods - It is written particularly for the Popup Free Chat Integration

Author(s): JoshPet of www.joshuapettit.com

Date: 06/14/03

Credits: JoshPet

Files Altered: ubbt.inc.php, ubbt_registerednav.tmpl, ubbt_unregisterednav.tmpl

New Files: None

Database Altered: None

Info/Instructions: Included in attachment.

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.


Attachments
84804-ShowUsersInChat1.0.txt (0 Bytes, 198 downloads)

Last edited by JoshPet; 06/14/2003 10:59 PM.
Sponsored Links
Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Awesome Josh... although, I think you need some sleep. The first file you say to edit is ubbt_registerednav.tmpl... when it should be ubbt.inc.php

And the last file you say to edit should be the template... but you say to edit ubbt.inc.php

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yup - I really should sleep to get the details right. LOL

I fixed the directions - thanks.

Joined: Aug 2003
Posts: 3
Lurker
Lurker
Offline
Joined: Aug 2003
Posts: 3
doesn't seem to do anything for me? i followed all the instructions correctly.

Last edited by jamie; 08/20/2003 6:58 PM.
Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Could you be more vague?

Sponsored Links
Joined: Jul 2001
Posts: 442
Enthusiast
Enthusiast
Offline
Joined: Jul 2001
Posts: 442
Will this work in 6.4?

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Not by default. The new menubar doesn't have just one cell for it's table, but has two now. So as per the instructions, this causes a problem because the template code you need to add kinda fudges that up.

You can fix it easily by moving it in it's own seperate table.. which I have done, but I have yet another problem. In the past, when nobody was in the chat, that table didn't display at all. But now, even when nobody is chatting, the border of that table still displays (most likely because I added a new table in the template to hold the chat info).

So.. I haven't had time to play around with it enough to work properly, but when I figure it out I can post the update to the code.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Ok, I see whoever installed that hack here has it working properly with the new menubar... someone needs to share the wealth I've been poking around for 20 minutes and can't get it to look right for me.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
According to the source here it should be as simple as this:

Code
<tr><br /><td class=lighttable align=middle colSpan=2><br />$chatoutput<br /></td><br /></tr>


Unless I'm screwing something up.. but when I do that on my site, it doesn't work, it puts the info only on the left column, and the far column is empty

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
The only thing you need to do is this Jeremy.

No new tables no new anything. Just add this in the $chatoutput HTML define in the td call

So in ubbt-inc.php you entered this

// ----------------------------
// Let's see if there are any people in the chat room - by JoshPet
$query = "
SELECT COUNT(*)
FROM {$config['tbprefix']}Online
WHERE O_What = 'chatheader'
OR O_What = 'chatroom'
OR O_What = 'chat'
";
$sth = $dbh -> do_query($query);
list($chatcount) = $dbh -> fetch_array($sth);
if ($chatcount == "1") {
$chatoutput = "<tr><td class="lighttable" align="center"><b>There is currently $chatcount user in the <a href="{$config['phpurl']}/chat.php" target="_top">Chat Room</a>. Join them!</td></tr>";
}
else if ($chatcount > "1") {
$chatoutput = "<tr><td class="lighttable" align="center"><b>There are currently $chatcount users in the <a href="{$config['phpurl']}/chat.php" target="_top">Chat Room</a>. Join them!</td></tr>";
}
else {
$chatoutput = "";
}
TWICE

CHANGE IT TO THIS

// ----------------------------
// Let's see if there are any people in the chat room - by JoshPet
$query = "
SELECT COUNT(*)
FROM {$config['tbprefix']}Online
WHERE O_What = 'chatheader'
OR O_What = 'chatroom'
OR O_What = 'chat'
";
$sth = $dbh -> do_query($query);
list($chatcount) = $dbh -> fetch_array($sth);
if ($chatcount == "1") {
$chatoutput = "<tr><td class="lighttable" colspan="2" align="center"><b>There is currently $chatcount user in the <a href="{$config['phpurl']}/chat.php" target="_top">Chat Room</a>. Join them!</td></tr>";
}
else if ($chatcount > "1") {
$chatoutput = "<tr><td class="lighttable" colspan="2" align="center"><b>There are currently $chatcount users in the <a href="{$config['phpurl']}/chat.php" target="_top">Chat Room</a>. Join them!</td></tr>";
}
else {
$chatoutput = "";
}

Sponsored Links
Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Ohhhh, it had to be changed in the actual $chatoutput definition...

thanks. That's what I get for trying to do something on my own without help

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Weird, I must be an idiot because that had no effect.

All that needs to be added is the colspan="2" I thought, and that is what your code shows too

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Nevermind, sorry for wasting your time. I only added it to the first instance and not the second in ubbt.inc.php

I need to just go to bed

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
LOL glad you got it yeah thats why i said TWICE in big letters.

Joined: Jan 2004
Posts: 79
Power User
Power User
Joined: Jan 2004
Posts: 79
I get an error when I install this.

Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /home/proguide/public_html/forum/ubbt.inc.php on line 1788

Fatal error: Call to undefined function: getmicrotime() in /home/proguide/public_html/forum/main.inc.php on line 16

I edited the templets and changed the code twice to the one above in the ubbt.inc.php . Any ideas?

Joined: Jul 2001
Posts: 808
Coder
Coder
Joined: Jul 2001
Posts: 808
it would be nice to put the sring from $chatoutput in the languages files so I can translate the output in needed languages.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Usually you're missing a } if you're getting that error - you might need to double check the directions, make sure you copy and paste. Make sure you don't copy over the closing } for the send_header function.

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
Does this work with sigma_chat.php in 6.3? I didnt get it to work on my first attempt but I may have missed some syntax.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
This would work with any script that is 'chat.php' or you can alter it - but it really has nothing to do with the chat program - it just counts users in who's online showing a certain location - in this case 'chat.php'.

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
Hmm..I changed chat.php to sigma_chat.php but nothing happened.. I don't see it anywhere lol..

Joined: Jan 2004
Posts: 79
Power User
Power User
Joined: Jan 2004
Posts: 79
Ok Josh, I didnt find the mistake so i grabed a new file and redid the new code on it. I copied and pasted from your uploaded file. I get this error.

Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /home/proguide/public_html/forum/ubbt.inc.php on line 1750

Fatal error: Call to undefined function: getmicrotime() in /home/proguide/public_html/forum/main.inc.php on line 16

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
[]ChAoS said:
Hmm..I changed chat.php to sigma_chat.php but nothing happened.. I don't see it anywhere lol.. [/]
Any ideas on this? I tried it twice maybe my Generic Header is interfereing with it?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
When you know that someone is in chat - you need to view the online table:
SELECT * FROM w3t_Online

And see what location that user is being shown as - then this mod simply counts the number of users showing whatever in the online table. The mod is setup to count them if their online location shows 'chat' in the online table. But I'm not familiar with whatever mod you're using. So you'll need to see what the location is reporting in the online table and adjust this mod accordingly.

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
This is what I get

Frost 1078093953 sigma_chat r 351

and I edited the four lines in ubbt.inc respectively (/sigma_chat.php)and still no worky.I double checked all my code several times too. This is such a simple modification and frankly I am baffled.

Threads 6.3

Link to ubbt.inc.txt

Last edited by ChAoS; 02/29/2004 6:29 PM.
Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
SELECT FROM w3t_Users WHERE U_Baffled> '0';
1 results returned ChAoS

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
LOL

OK - that was helpful. You're editing the link to the chat room - which is good. But since it's showing as 'sigma_chat' in the online table - we need to alter the query to grab users at that location - right now it's looking for people on pages you don't have.

I think this query is used twice.... but basically find this:

Code
<br />	       SELECT COUNT(*)<br />		       FROM   {$config['tbprefix']}Online<br />		       WHERE  O_What = 'chatheader'<br />		       OR    O_What = 'chatroom'<br />		       OR 	 O_What = 'chat'<br />


And change it to this:
Code
<br />	       SELECT COUNT(*)<br />		       FROM   {$config['tbprefix']}Online<br />		       WHERE  O_What = 'sigma_chat'<br />

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
Mr. Bug you have done it again. Where do I send the Ice Cream?

Thankyou
PS.
SELECT FROM w3t_Users WHERE U_RHappy> '0';
340 results returned

See what you started?

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
Josh I notice that sometimes the chat header dissappears and isnt showing. Does is not show up if the chatroom is empty? As of right now one person is in chat and it has dissappeared again. In fact I just ran the query in your above thread and SQL doesn't show him in chat. I believe he has been in there AFK for a while. Does SQL time out after a while if a user is not active?

So many questions,So little time

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
They drop off the online table after whatever time period you specify (default 10 minutes). Threads cannot track them or update their activity time unless you are refreshing the page. So not sure what mod you're using. One of my mod used a pop-under window which refreshed every 9 mintues and updated their location - and my current Raidersoft mod updates a header (in an iframe) every 9 minutes to keep the table updated. But if the page isn't refreshing - they "drop off" the list after the specified time of inactivity. Even if they are in chat - threads isn't tied into the chat server in any way to know this.

Joined: Jan 2004
Posts: 79
Power User
Power User
Joined: Jan 2004
Posts: 79
Can some one help me with the first question on this page?

Thanks ; )

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Well - everyone might have a different post first on thier page depending on how many posts they have per page.

I glanced through - what was not already answered in this thread?

Joined: Nov 2003
Posts: 5
Lurker
Lurker
Joined: Nov 2003
Posts: 5
[]jamie said:
doesn't seem to do anything for me? i followed all the instructions correctly. [/]

My guess is you're limiting use to authenticated users, so you only need to show users in ubbt_registerednav.tmpl. Unfortunately, the comment above the include of ubbt_unregisterednav.tmpl in ubbt.inc.php is wrong:

// Now require the registerednav.php template
$html = new html;
list($tbopen,$tbclose) = $this -> table_wrapper();
if (!$debug) {
include("$thispath/templates/$tempstyle/ubbt_unregisterednav.tmpl");
}

So you may end up adding it to a nav bar that will never show any users. I ran into that briefly.

-Conrad

Joined: Nov 2003
Posts: 5
Lurker
Lurker
Joined: Nov 2003
Posts: 5
Since I'd rather not add a whole other row to the nav bar, I just show the number of users in the chat room (if any) in parens next to the main link to it:
Code
 <br />ubbt.inc.php:<br /><br />        // Show how many users in chat room<br />        $query = "SELECT COUNT(*)<br />                  FROM   {$config['tbprefix']}Online<br />                  WHERE  O_What = 'chatheader' OR<br />                         O_What = 'chatroom' OR<br />                         O_What = 'chat'";<br />        $sth = $dbh->do_query($query);<br />        list($chat_count) = $dbh->fetch_array($sth);<br />        if ($chat_count) {<br />          $s = ($chat_count == 1) ? '' : 's';<br />          $chat_output = "($chat_count user$s)";<br />        }<br /><br />ubbt_registerednav.tmpl:<br /><br /><a href = "$phpurl/chat.php?Cat=$Cat" $target>{$ubbt_lang['CHAT_ROOM']}</a><br />$chat_output<br />

[Repeat for ubbt_unregisterednav.tmpl if desired]

-Conrad


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)