vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   [Add on] Who's Chatting on Forum Home Page for Sigmachat (https://vborg.vbsupport.ru/showthread.php?t=67456)

ChurchMedia 07-20-2004 10:00 PM

[Add on] Who's Chatting on Forum Home Page for Sigmachat
 
Add-on by ChurchMedia
Who's Chatting on Forum Home Page for Sigmachat

You must have the SigmaChat Complete Integration & Authentication hack installed first and be signed up with SigmaChat, of course.

This will add a "Who's Chatting" box on your forum home page.

Just like "Who's Online", if you click on "Who's Chatting" it will take you to a page with just the chatters.

If you are logged in, there is a link to the chat room. If you are not logged in, there is a link to register.

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Note that the problem of having a space in your user name is corrected. However, if the user name has an _underscore_ in it there may be problems.
To remove the feature that replaces underscores with spaces, remove this line (Line 57 in chat_home.php):

PHP Code:

$username str_replace("_"" ",$username); 

1 file change
1 new template
2 template changes

WARNING #1: This hack WILL speed up your Who's Chatting hits! If you seriously want Who's Chatting on your front page, keep in mind that you may have to buy extra hits! Otherwise, don't install this hack! :) I've found that it increased my chat room traffic dramatically, so I think it's worth buying the hits.

WARNING #2: When you do run out of Who's Chatting hits, your forum home page will break (you will get a blank page)! If this happens, in forum/index.php FIND
PHP Code:

include('chat_home.php'); 

and replace it with
PHP Code:

//include('chat_home.php'); 

Then buy more chat hits. When your upgrade goes through, remove the // from the line above to reactivate the hack.

Dean C 07-21-2004 06:01 PM

I've put your one-liner in php tags so unlicensed users can't see it - better safe than sorry ;) Thanks for sharing your work with the community once again :D!

Bryan Ex 07-21-2004 06:45 PM

This or at least a number display for chatters has been requested for a long time but won't this consume your "Who's chatting" hits from Sigmachat at a drastic rate? If it's only refreshed every so often (10 minutes or longer) I'll install this afternoon but if it's live and refreshes with every page view... ouch!

ChurchMedia 07-21-2004 07:36 PM

Quote:

Originally Posted by Dean C
I've put your one-liner in php tags so unlicensed users can't see it - better safe than sorry ;) Thanks for sharing your work with the community once again :D!

Thanks, Dean!

ChurchMedia 07-21-2004 08:04 PM

Quote:

Originally Posted by Bryan Ex
This or at least a number display for chatters has been requested for a long time but won't this consume your "Who's chatting" hits from Sigmachat at a drastic rate? If it's only refreshed every so often (10 minutes or longer) I'll install this afternoon but if it's live and refreshes with every page view... ouch!

Honestly, I didn't know about the who's online hits! Opps! I have a Platinum account and it's showing 5500 hits left -- but I didn't buy any extra hits (???). Is it 100 free hits per month?

I don't see a way around the problem of it hittng everytime someone visits the home page... Personally, my chat room is so popular I'm willing to spend the extra money for the hits if I have to.

Bryan Ex 07-21-2004 08:17 PM

They allow you 146 hits per day I think it is (carried forward) which works out to about 1 per every ten minutes 24/7. If there was a way to cache the who's online data for 10 minute intervals it would be just about perfect. I believe that once their new release goes final that the updated integration script will include some type of feature like that but being so close to things changing they haven't bothered. I made a similar error by placing the total number of chatters next the chat link in the nav bar and a few days later I was out of hits for the rest of the month. Whoops...lol

JustAskJulie 07-22-2004 04:39 PM

I didn't think there was a limit on paid accounts.

Bryan Ex 07-22-2004 05:13 PM

There is indeed... it's just that most paid accounts get more than they use and they are compounded over time.

https://vborg.vbsupport.ru/showpost....3&postcount=69

ChurchMedia 07-28-2004 03:01 AM

Right -- you do have to pay for the Who's Chatting hits. My forum burned through 5000 hits in a few days. When you run out of hits, the forum home page BREAKS with this hack (blank page). You have to disable the hack, buy more hits and re-enable it when your upgrade goes through.

I'm still deciding if it's worth it, but I think it is. Chat traffic when up dramatically when I installed this hack.

When I have more time, I'll look into caching the info to slow down the hits.

tamarian 07-28-2004 03:18 AM

Best way, IMHO, is to cache the who's on line stuff as a cron job, once every 6 minutes :)

ChurchMedia 07-28-2004 03:22 AM

Good idea! I'd still need to do some new coding to make that happen. I'll be out for a few weeks, but I'll try to get back to it. Feel free to work on it if you like :)

Bryan Ex 07-28-2004 03:50 AM

If someone is able to pull that off... I'm definitely interested!

tamarian 07-28-2004 07:57 PM

I actually have it running on my forum right now. I'll do some cleanup and upload the script + instructions.

Bryan Ex 07-28-2004 08:27 PM

What's the refresh rate for updates tamarian?

tamarian 07-28-2004 08:33 PM

It would be up to you, as it's a cron job and can be set to any rate. I initially thought we could do once every 6 minutes, but SigmaChat gives less credit, so now I have it at once every 10 minutes.

Hey, I see you're in Ottawa, me too :)

Bryan Ex 07-28-2004 08:38 PM

Quote:

Originally Posted by tamarian
It would be up to you, as it's a cron job and can be set to any rate. I initially thought we could do once every 6 minutes, but SigmaChat gives less credit, so now I have it at once every 10 minutes.

10 minutes is just about right however it won't account for anyone using the regular Who's Online module if that's also installed... or does this cron affect both?


Quote:

Originally Posted by tamarian
Hey, I see you're in Ottawa, me too :)

You betcha ... a true Bytown lad here for sure. :nervous:

tamarian 07-28-2004 08:45 PM

Quote:

Originally Posted by Bryan Ex
10 minutes is just about right however it won't account for anyone using the regular Who's Online module if that's also installed... or does this cron affect both?

You wouldn't need the who's on line stuff, since this will cache the number of those in chat in one template, and a list of their member names in another template.

Of course, you can have both working if you want to, but there's no need.

Template #1 has something like this "Currently chatting: 3 members"

Template #2 has something like this "user1, user2, user3"

I put template #1 in the forum home stats box, and template #2 in the what's going on box.

lazytown 08-16-2004 01:05 AM

Ok so any news on the cache/cronjob update?

tamarian 08-16-2004 04:14 PM

Quote:

Originally Posted by vissa
Ok so any news on the cache/cronjob update?

Well, I haven't had time to clean up. I'd be glad to post it as is here, instead of a full release, as it's quite "hacky" :) But it's been running on my forum for a while.

lazytown 08-16-2004 07:56 PM

Quote:

Originally Posted by tamarian
Well, I haven't had time to clean up. I'd be glad to post it as is here, instead of a full release, as it's quite "hacky" :) But it's been running on my forum for a while.

Post Away Please!

tamarian 08-17-2004 10:58 PM

O.k., here goes:

Note: You need the chat_global.php from the sigma chat hack provided by sigmachat.

1. Create a new file called chat_cache.php or something else, and paste this into it:

PHP Code:

<?php
  
  
// replace with actual path to your forum main directory, no trailing slash
          
chdir("/path/to/forum");
  
        require_once(
"./global.php");
        require_once(
"./chat_global.php");
  
        
error_reporting(E_ALL & ~E_NOTICE);
        
define('NO_REGISTER_GLOBALS'1);
        
define('THIS_SCRIPT','chat_online');
  
        
$globaltemplates = array("sigmachat_chatting",);
  
        
$SIGMACHAT_CP_PASSWORD_MD5 md5($SIGMACHAT_CP_PASSWORD);
      
$womurl "http://$SIGMACHAT_SERVER/vbwho.pl?id=$SIGMACHAT_CHAT_ROOM_ID&pw=$SIGMACHAT_CP_PASSWORD_MD5";
  
        
$users = array();
        
$user_count = -1;
        
$wom_hits_remaining 0;
        
$wom_message '';
        if(
$womh fopen($womurl'r'))
        {
           while(!
feof($womh))
           {
              
$womcontent fgets($womh1048576);
              if(
$user_count == -1)
              {
                 
$wom_hits_remaining $womcontent;
                 
$user_count++;
              }
              else if( (
$user_count == 0) && ($wom_hits_remaining 0) )
              {
                 die;
              }
              else
              {
                 if(
$womcontent != '')
                  
$users[] = rtrim($womcontent);
                 
$user_count++;
              }
           }
           
fclose($womh);
        }
        else
        {
           die;
        }
  
        
$SIGMACHAT_CHATTING_COUNT $user_count;
      if (
$SIGMACHAT_CHATTING_COUNT 0$SIGMACHAT_CHATTING_COUNT "Chatting: " $SIGMACHAT_CHATTING_COUNT;
          else 
$SIGMACHAT_CHATTING_COUNT "";
  
          foreach(
$users as $username)
        {
           
$SIGMACHAT_USERNAME "$username";
  
          if (
$bbuserinfo $DB_site->query_first('SELECT userid, usergroupid, username, salt FROM ' TABLE_PREFIX 'user WHERE username = "' addslashes(htmlspecialchars_uni($username)) . '"'))
           {
          
$SIGMACHAT_USERNAME "<a href=\"member.php?u=" $bbuserinfo[userid] . "\">" $bbuserinfo[username] . "";
           }
  
      
$chat_names .= "<a href=\"member.php?u=" $bbuserinfo[userid] . "\">" $bbuserinfo[username] . "" ", ";
  
        }
          
$chat_names addslashes($chat_names);
      
$DB_site->query("UPDATE " TABLE_PREFIX "template SET template=\"$SIGMACHAT_CHATTING_COUNT\", template_un=\"$SIGMACHAT_CHATTING_COUNT\" WHERE title='sigmachat_chatting_cache_bit'");
      
$DB_site->query("UPDATE " TABLE_PREFIX "template SET template=\"$chat_names\", template_un=\"$chat_names\" WHERE title='sigmachat_chatting_cache'");
  
?>

2. Update the first line in the code above with the right path to your forum home dir on your server.

3. Create two empty templates: sigmachat_chatting_cache_bit and sigmachat_chatting_cache

4. Edit index.php

Find:

PHP Code:

'FORUMHOME'

Add after:
PHP Code:

         'sigmachat_chatting_cache',
         
'sigmachat_chatting_cache_bit'

Find:

PHP Code:

$today vbdate('Y-m-d'TIMENOWfalsefalse); 

Add after:

PHP Code:

$sigmachat_chatting =  $templatecache['sigmachat_chatting_cache'];
 
$sigmachat_chatting_bit =  $templatecache['sigmachat_chatting_cache_bit']; 

5. Use $sigmachat_chatting_bit and $sigmachat_chatting in your FORUMHOME template. The first has the number of members in the chat room, and the second has the list of the members and their profile links.

6. Add a cron job to your server, ever 10 minutes. Example:

*/10 * * * * /usr/bin/php /path/to/forum/chat_cache.php > /dev/null 2>&1

7. If you have a problem, feel free to ask, but keep in mind that you need to back up your files and templates in case it doesn't work for you.

Brent H 10-19-2004 05:52 PM

This is my first time trying to add a cron job to my site, and I have no idea where to begin. Where do I put that bit of code in?

Brent H 10-20-2004 02:26 AM

Alright nevermind, I just asked my hosting company and they rudely told me they don't support it. Jerks.

I've got it installed and the link goes to the embedded chat... I want it to pop up. I don't know how to change it :(

EDIT: Woot, fixed it. Ain't it great when you go begging for help, and then figure out how to do it all by yourself? I feel like such a big boy now.

rstan 08-06-2005 07:37 PM

/cloaked users show in who online.....anyone else notice this?

Bounce 09-08-2005 08:38 PM

How come mine is showing -1 Users when there is indeed 0 folk in my room :nervous:

j?rg 10-03-2005 09:40 AM

hi,

have someone a plugin for vb3.5.

i want display the userĀ“s on my forumhome!


All times are GMT. The time now is 08:18 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.01299 seconds
  • Memory Usage 1,835KB
  • 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
  • (8)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (26)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete