vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   # of users in forum on forumhome (https://vborg.vbsupport.ru/showthread.php?t=38012)

Neo 04-28-2002 10:00 PM

# of users in forum on forumhome
 
Ok here it is.. I have seen a few requests for it... so here it is.

Info:
What it does is show the number users in a forums on your forum home / main page.


Install Info:
2 File Adds
6 template edits


Thats it. I will post images below if you need an idea of what it looks like :)

Here is the new version of it. " Thanks Chen :bunny: "
The first file will be posted below it you need to unistall or would like to use it O__O

Neo 04-29-2002 07:50 AM

Image :cool:

Zzed 04-29-2002 08:22 AM

Very cool. :)

John 04-29-2002 08:46 AM

Nice :)

JulianD 04-29-2002 08:50 AM

Thanks for sharing neo! Nice hack!

Erwin 04-29-2002 10:06 AM

Thanks neo - I modified it so that I can show how many users are using a particular forum in the header of every page - My java chat is actually a forum on my site, and this is what I've been looking for to show who's chatting. :)

Admin 04-29-2002 11:26 AM

This adds another query for each forum you have... ouch.

Admin 04-29-2002 11:54 AM

This is how I did it, only adds one query to the index page and the query is quite fast as well.

I added this somewhere:
Code:

// Users browsing each forum
$getforumbrowsers = $DB_site->query('
        SELECT COUNT(*) AS count, inforum
        FROM user
        WHERE lastactivity>'.($ourtimenow - $cookietimeout).'
        AND lastvisit<>lastactivity
        GROUP BY inforum
');
$forumbrowsers = array();
while ($getforumbrowser = $DB_site->fetch_array($getforumbrowsers)) {
        $forumbrowsers[$getforumbrowser['inforum']] = $getforumbrowser['count'];
}

Then stuck this inside the makeforumbit() function:
Code:

                global $forumbrowsers;
                $browsers = $forumbrowsers[$forum['forumid']];
                if (intval($browsers) < 1) {
                        $browsers = 0;
                }

Then used $browsers in the template.

SWFans.net 04-29-2002 01:42 PM

Quote:

Originally posted by FireFly
I added this somewhere:
Code:

// Users browsing each forum
$getforumbrowsers = $DB_site->query('
        SELECT COUNT(*) AS count, inforum
        FROM user
        WHERE lastactivity>'.($ourtimenow - $cookietimeout).'
        AND lastvisit<>lastactivity
        GROUP BY inforum
');
$forumbrowsers = array();
while ($getforumbrowser = $DB_site->fetch_array($getforumbrowsers)) {
        $forumbrowsers[$getforumbrowser['inforum']] = $getforumbrowser['count'];
}


I tried it in several places in index.php withno luck, does it need to be in forumdisplay.php as well?

Admin 04-29-2002 01:47 PM

No, just index.php.

SWFans.net 04-29-2002 01:49 PM

Alright, thanks. :)

KuraFire 04-29-2002 04:01 PM

Thanks Neo, for the idea, and thanks FireFly, for the less server-killing improvement. *hits install button*

Neo 04-29-2002 05:08 PM

Cool Firefly thanks for the insight :)

Old File :

Floris 04-29-2002 08:57 PM

Nice addition, when I install it next month, then I will add it to the board description though :) Saves me another column in the design.

Twig Deez 04-29-2002 10:48 PM

hey. groovy!

i put it in my forum description too, tho; right after the forum title.
i dunno, i'll fiddle around with the location a bit in a while.

nice work, neo/firefly! :)

Crazy Mofo 04-29-2002 10:49 PM

Uh i can't find this :(



PHP Code:

In forumhome or where it might be find #####

<td bgcolor="{tableheadbgcolor}"><smallfont color="{tableheadtextcolor}"><b>Threads</b></smallfont></td>

##### And place this under it ( you can place edit this to format your site) #####

<td bgcolor="{tableheadbgcolor}"><smallfont color="{tableheadtextcolor}"><b>Users Viewing</b></smallfont></td


Neo 04-30-2002 12:11 AM

it might also be in forumhome_forumbit_level1_nopost

Erwin 04-30-2002 12:42 AM

Quote:

Originally posted by FireFly
This is how I did it, only adds one query to the index page and the query is quite fast as well.

I added this somewhere:
Code:

// Users browsing each forum
$getforumbrowsers = $DB_site->query('
        SELECT COUNT(*) AS count, inforum
        FROM user
        WHERE lastactivity>'.($ourtimenow - $cookietimeout).'
        AND lastvisit<>lastactivity
        GROUP BY inforum
');
$forumbrowsers = array();
while ($getforumbrowser = $DB_site->fetch_array($getforumbrowsers)) {
        $forumbrowsers[$getforumbrowser['inforum']] = $getforumbrowser['count'];
}

Then stuck this inside the makeforumbit() function:
Code:

                global $forumbrowsers;
                $browsers = $forumbrowsers[$forum['forumid']];
                if (intval($browsers) < 1) {
                        $browsers = 0;
                }

Then used $browsers in the template.



Chen,

I tried your code in my index.php and all I see is "0" for the $browser value in all my forums. I am fairly sure I've put the code in the right place.

If you don't mind, I will PM you my index.php for your perusal, to see if everything is in the right place.

Crazy Mofo 04-30-2002 01:03 AM

Erwin which template did u put $browsers in?

N!ck 04-30-2002 01:04 AM

verify you have added the code to forumdisplay.php

Erwin 04-30-2002 01:08 AM

I moved the second bit of code around a bit, and it works now. Basically you cannot just put the makeforumbits code anywhere in that function. You need to place it exactly where neo said in his text file. Sorry to bother all of you. :)

Nice hack Firefly and Neo.

Crazy Mofo 04-30-2002 01:11 AM

well can u share it with me :D from da begining ;)

TECK 04-30-2002 01:11 AM

grrrrrrrrrrrreat hack!! thanks neo and firefly.
i made a little mod to it and place also a link to online users.. for now. i plan to extend the online users, per forum not global the way it is now, in VB.

for now i use this link:
Code:

<a href="online.php?s=$session[sessionhash]" title="$activeusers Viewers In $forum[title]">$activeusers Active Users</a>
here it is a graphic example...

Crazy Mofo 04-30-2002 01:16 AM

nice but still i aint got it working :( can some1 make a new installatino txt file the latest one?

TECK 04-30-2002 01:28 AM

the install readme file on the first post is reliable. follow the instructions posted there.

Crazy Mofo 04-30-2002 01:30 AM

ah oki....

is that the one that vb.org is using here?

Neo 04-30-2002 01:45 AM

Cool Nakkid :)

TECK 04-30-2002 01:53 AM

Quote:

Originally posted by Crazy Mofo
is that the one that vb.org is using here?
what difference does it makes? i'm sure firefly have his own code for all the hacks he installed here.. he gets the idea and after he "devellop" it.. ;)
the important thing is that the code above works great. :D
let us know how your install went... if you need any help, post it here and we will give you a hand.

Crazy Mofo 04-30-2002 01:56 AM

Ok thx and sorry for being a newbie :cry: :ermm:

TECK 04-30-2002 02:02 AM

Quote:

Originally posted by Crazy Mofo
Ok thx and sorry for being a newbie :cry: :ermm:
nobody is a newbie here.. we are all toghether to help eachothers.. :D
dont worry and dont feel shy to ask...

Crazy Mofo 04-30-2002 02:20 AM

should there be a 0 showing up if no1 is browsing?

TECK 04-30-2002 02:26 AM

how would i do a LEFT JOIN to include also the guests?

TECK 04-30-2002 02:27 AM

Quote:

Originally posted by Crazy Mofo
should there be a 0 showing up if no1 is browsing?
yes

Crazy Mofo 04-30-2002 02:28 AM

o dear i have a problem :/

TECK 04-30-2002 02:31 AM

what is the prob? let us know...

Crazy Mofo 04-30-2002 02:31 AM

can i send some1 my index and forumdisplay too av a look at?

Crazy Mofo 04-30-2002 02:32 AM

well nuttin shows up atall no numbers etc.. i actully got the bar too show though thx too you nakkid :D

Crazy Mofo 04-30-2002 02:36 AM

heres the pic

TECK 04-30-2002 02:49 AM

let's recap toghther crazy.. do this:
in index.php find:
Code:

// Start makeforumbit
ABOVE this, add:
Code:

// users browsing each forum
$getforumbrowsers=$DB_site->query('SELECT COUNT(*) AS count,inforum
                                  FROM user
                                  WHERE lastactivity>'.($ourtimenow-$cookietimeout).'
                                  AND lastvisit<>lastactivity
                                  GROUP BY inforum');
$forumbrowsers=array();
while ($getforumbrowser=$DB_site->fetch_array($getforumbrowsers)) {
  $forumbrowsers[$getforumbrowser['inforum']]=$getforumbrowser['count'];
}

still in index.php, find:
Code:

        if ($forum['cancontainthreads']==1) {
          $tempext = '_post';
        } else {
          $tempext = '_nopost';
        }

BELOW this, add:
Code:

        global $forumbrowsers;

        $count=$forumbrowsers[$forum['forumid']];
        if (intval($count)<1) {
          $count=0;
        }

now, in forumdisplay_forumbit_level1_post and forumdisplay_forumbit_level2_post find:
Code:

        <td bgcolor="#F1F1F1"><normalfont>$forum[threadcount]</normalfont></td>
BELOW, add this:
Code:

        <td bgcolor="#F1F1F1"><normalfont>$count</normalfont></td>
that should do it... let us know if everything is ok.

TECK 04-30-2002 02:53 AM

neo (should i say firefly? ;))... please make me happy and add that LEFT JOIN.. actually can anyone tell me if it will bring the server to it's knees if i do this? add also the guests into it?

here what i did:
Code:

$getforumbrowsers=$DB_site->query('SELECT COUNT(*) AS count,inforum
                                  FROM user
                                  LEFT JOIN session ON (what do i put here?)
                                  WHERE lastactivity>'.($ourtimenow-$cookietimeout).'
                                  AND lastvisit<>lastactivity
                                  GROUP BY inforum');

i guess i have to add a inforum field in the session table... do i have to index it also?


All times are GMT. The time now is 04:47 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.01276 seconds
  • Memory Usage 1,826KB
  • 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
  • (13)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)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
  • (40)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