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)

Velocd 07-22-2002 05:33 PM

I'm wondering who has got this to work without having to clear your cookies everytime you leave the chat, in order to get the "who's chatting" updated. I saw the solution with the popup on the first page, but surely there is an automatic way...

Velocd 07-22-2002 06:39 PM

Never mind, after awhile tinkering with the code I have finally got it to work :)

Simply perfect, I have it working with the IRC Bocazas chat hack and everything works fine. This hack causes no performance drop either, for those questioning this. Only thing I wish could be possible is if users using mIRC, or another chat client, could be picked up also..ofcourse that logically isn't possible with this hack.

SloppyGoat 12-28-2002 09:46 PM

Quote:

Originally posted by X-Fan
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.



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

This looks like a great hack, but I can't quite figure it out. Can someone clue me in a bit? First, I don't know how to find out what usergroup id is the admin! How is this done? Second, will I need to edit the other usergroupid's listed in this code? I'm not very knowledgeable in php. Please elaborate for idiots like me. What is usergroup 5, 6, and 7 in this example? :confused: I think I'm close, if i can just figure out this usergroupid thing. :(

[edit]
Ok, I figured out how to find it in phpmyadmin, and my usergoupid's are the same, so now I don't know what I'm doing wrong....unless the db needs to be modified?

I keep getting this db error when I try this:

Invalid SQL: SELECT username,invisible,userid,usergroupid FROM user WHERE inchat=1 AND lastchatactivity>1041116216 ORDER BY invisible ASC, username ASC
mysql error: Unknown column 'inchat' in 'where clause'

mysql error number: 1054

Do I need to modify the db with this?

ALTER TABLE user ADD lastchatactivity int(10) unsigned DEFAULT '0' not null
ALTER TABLE user ADD inchat smallint(4) DEFAULT '0' not null

If so, how do I do that? I do have phpmyadmin installed, but don't know much about it. :ermm:

[edit2]
AAAARRRRGGGHHHH!!! Well, I added those two to my user table, but it still didn't do anything.

lifesourcerec 01-07-2003 04:40 AM

Yes, use phpMyAdmin. If you enter it, use this:

ALTER TABLE user ADD lastchatactivity int(10) unsigned DEFAULT '0' not null;
ALTER TABLE user ADD inchat smallint(4) DEFAULT '0' not null

A ";" was missing.

Works great for me now.. but messes up another script.

SloppyGoat 01-07-2003 12:33 PM

Thanks, I'll try it again then. What other script does it mess up, though? :disappointed:

lifesourcerec 01-08-2003 04:24 AM

The Top 5 Statistics hack.

In the "Top 5 Newest Members:", whenever someone joins the chat, it will put their name before the first new user.

Conflict with $username.

SloppyGoat 01-08-2003 12:25 PM

Ok cool. I don't use that hack anyway. :)

hubba 05-02-2004 05:40 PM

Hm, in VB 3 this gives a database eroor?

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

hubba 05-09-2004 03:50 PM

Wahhh isnt it possible to rewrite that to VB3???


All times are GMT. The time now is 09:48 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.01092 seconds
  • Memory Usage 1,757KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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