vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   Active Users in Chat (Works with any web chat client including JPilot) (https://vborg.vbsupport.ru/showthread.php?t=34065)

lifesourcerec 03-22-2002 06:17 AM

Quote:

Originally posted by PhotoGenie
No clicking sound.. Great!!.. You have to wait on the cookie to clear to be shown as logged out of the chat. I found an alternative and that was to add a popup on exit to the frameset. Then I created another php file I named chat_logout.php ..

The new php file looks like this:

<?php
require("global.php");
if( $bbuserid ) {

$DB_site->query("UPDATE user SET inchat='0' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("UPDATE user SET lastchatactivity=$ourtimenow WHERE userid='$bbuserinfo[userid]'");
} else {

} // end if
?>
<head>
<title>Chat Log-Out</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<BODY onLoad="setTimeout(window.close, 5000)"
</body>
</html>

Is the above the new main_top.php file?

nighteyes 03-23-2002 06:39 AM

Quote:

Originally posted by Swamper
...I had a need for this sort of thing last year and the majority of the regular users in my chat now don't use the java client anymore so there was no accurate way to do it with mysql :) - So I just set up an eggdrop bot in the channel and have it running a simple TCL script I wrote that writes out the # of people in the channel to disk every time someone joins (didn't bother to have it do it when someone leaves - but that's easy to add too)

..then set up a crontab to copy the file over to my web directory (since the bot runs as user nobody) and within global.php have:

$fd = fopen ("path/to/file_with_number_in_chat", "r");
$num_in_chat = fgets($fd, 3);
fclose ($fd);

...then just insert $num_in_chat in a template or wherever and I have easy access to it..

Would you possibly mind sharing this TCL script? And how you have cron setup? This would be a far more efficient way of doing things than using MySQL. :) vbulletin has enough mysql queries already going on.

Swamper 03-23-2002 09:31 PM

Here is my crontab:

* * * * * root /path/to/file_to_run

contents of file_to_run:

/bin/cp /path/to/eggdrop/numchat.txt /path/to/yoursite.com/wherever

Make sure to chmod 755 the file_to_run afterwards...

I modified the peak eggdrop script (announces in channel whenever a new record is set for # of ppl in the channel) - I just added to line 31:

Code:

set fid [open "numchat.txt" "WRONLY CREAT"]
puts $fid $curnum
close $fid

Change the filename to whatever you want (not necessary)

Then in your bot config file add:

source scripts/peak1.5.tcl

That's it :) Enjoy

Patrik 04-14-2002 09:41 AM

I followed the instructions for jPilot, added the include for displachatusers.php in my index.php the way explained and added the $chatters to my header, but nothing happens... Any idea why I can't see the people ?

Harryli 04-20-2002 07:28 PM

Hm , is it possible that since 2.2.5 the $chatters wont work? I changed nothing, use the same templates, but the chatters are shown no more ... ??? I cant see any reason for this... but now noone is shown as chatting

kypdurron 06-26-2002 07:32 PM

Ok..so I'm working on a better integration with IRC.
Can I do the following:

I want to pass a channel name as a parameter, and I want to know who is in that channel.

This way, all the users are in "#ForumChat" will be displayed

and there is also a "#ForumsAdmin" Channel, which will also be displayed.

I DO NOT want to have one bot per channel, as the number of channels that I want to do this for can be infinite.

So..it will show you who is in chat for all users, plus
moderators can see who is in the #forumchat and if
there is people in another channel, say #forumsadmin.

Any thoughts?

X-Fan 06-28-2002 03:05 PM

Just installed this hack, and I just can't get it working. I can get a chat section to come up on my forum's main page, but it's not listing any of the users in the chatroom at the time.

Help!!!

Also, how would you get the number of users currently in the chat to display like the number of users online?

X-Fan 06-28-2002 03:58 PM

Well whaddya know, I got it working! :)

Forgetting about displaychatusers.php I decided to go straight for index.php, into which I added this code...

PHP Code:

// get chatters
$datecut=time()-$cookietimeout;
$chatters '';
$comma '';
$forumusers $DB_site->query("SELECT username,invisible,userid,usergroupid FROM user WHERE inchat=1 AND lastchatactivity>$datecut ORDER BY invisible ASC, username ASC");
while (
$forumuser $DB_site->fetch_array($forumusers)) {
    if (
$forumuser['invisible']==or $bbuserinfo['usergroupid']==or $bbuserinfo['usergroupid']==or $bbuserinfo['usergroupid']==7) {
        
$userid $forumuser['userid'];
        if (
$forumuser['invisible'] == 1) { // Invisible User but show to Admin
        
$invisibleuser '*';
        } else {
        
$invisibleuser '';
        }
        if (
$forumuser['usergroupid'] == and $highlightadmin) {
            
$username "<b><i>$forumuser[username]</i></b>";
        } else if ((
$mod["$userid"] or $forumuser['usergroupid'] == 5) and $highlightadmin) {
                  
$username "<b>$forumuser[username]</b>";
        } else {
        
$username $forumuser['username'];
        }
    eval(
"\$chatters .= \"".$comma.gettemplate('forumhome_loggedinuser')."\";");
    
$comma ', ';
    }


after this code...

PHP Code:

} else {
  
$pminfo='';


and it works great! (FYI, my usergroupid of 6 is my administrators group. You'll need to change it to whatever yours is if you want to use this code.)

I managed to get the number of users currently in chat displayed as well. I just added this code to index.php:

PHP Code:

// get total chatters
$datecut=time()-$cookietimeout;
$chatnum mysql_num_rows(mysql_query("select * from user WHERE inchat=1 AND lastchatactivity>$datecut")); 

after the above code and it works fine.

Then added this to the bottom of the forumhome_loggedinusers template:

Code:

<tr id="cat">
        <td bgcolor="#336D95" background="https://vborg.vbsupport.ru/images/catagory_backing.gif" colspan="6"><a href="chat/"><normalfont color="#000000"><b>Users Chatting</b></normalfont></a><normalfont color="#000000"><b>: $chatnum</b></normalfont></td>
</tr>
<tr>
<td bgcolor="#1C5780" align="center" valign="top">
<a href="chat/"><img src="https://vborg.vbsupport.ru/images/activechatters.gif" alt="Users Chatting" align=middle border=0></a>
</td>
        <td bgcolor="#13486D" colspan="5"><smallfont>
        $chatters</smallfont></td>
</tr>

to show it all on the front page after the logged in users section.

amykhar 06-29-2002 01:28 AM

working quite well on 2.2.6 Thank you :)

Amy

Matt 07-19-2002 02:02 AM

How do I make it so I can show the number of people in the chat? Fantastic hack btw!! :D


All times are GMT. The time now is 11:07 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01144 seconds
  • Memory Usage 1,767KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete