Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 11-23-2014, 08:36 PM
SH0CK SH0CK is offline
 
Join Date: May 2007
Location: TN
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Count users on a certain page

I'm trying to figure out how I could use Vbulletin to report to me how many users are on a particular page, then turn this into a variable that I can plug into the template for navigation?

We have a chat page, let's say it is chat.php, which shows up under "Who's online" as Unknown Location /forums/chat.php

Is there a way to use this information to get a count of users accessing the page and set it as a variable so we can display it elsewhere?

Thanks!
Reply With Quote
  #2  
Old 11-23-2014, 08:40 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your best bet would be to ask in the modifications thread, like how they store the users in the chat mod, and if what you want to do is even possible.
Reply With Quote
  #3  
Old 11-24-2014, 12:21 PM
SH0CK SH0CK is offline
 
Join Date: May 2007
Location: TN
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is a flash IRC client running on the chat.php, so the only interaction it has with the board is that it's housed on a forum page and pulls the usernames when you first login to the client. I don't think it stores any info other than showing on the online page that someone is accessing that page.

I was just thinking there would have to be a way to set a number variable for how many user are accessing a particular thread or page at one time and being able to report it. Maybe a SQL query?

Admins, if this question needs to be in another area of this board, please move it for me. Thanks!
Reply With Quote
  #4  
Old 11-24-2014, 12:29 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The session table has a column called location, which you can use to count the number of users who are on that specific page.

PHP Code:
SELECT COUNT(*) as users FROM session WHERE location 'chat.php' 
Might want to add a check on the last activity though.
Reply With Quote
2 благодарности(ей) от:
ozzy47, SH0CK
  #5  
Old 11-24-2014, 12:31 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If the chat page shows up in "who's online", then you should be able to do a query to find out how many users are showing up as chatting (Edit: like Dave mentioned above). But that would only tell you how many people have looked at the chat page in the last 15 minutes (or whatever your session timeout is set to) and not necessarily how many users are active. The flash client probably knows how many users are active, but unless it has some kind of interface to share that info, then I'm not sure if there's any way to do what you want.
Reply With Quote
Благодарность от:
ozzy47
  #6  
Old 11-24-2014, 12:32 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, AFAIK the last known location (as a path relative to forum root) for every active user session. You could just run a count across that table, filtering by location.

That's pretty rough, of course, but the only possibility I can think of. vB itself AFAIK does nothing else for its own active users in forums functionality.

--------------- Added [DATE]1416839589[/DATE] at [TIME]1416839589[/TIME] ---------------

Yeah, well, three answers, and I come in last *lol*. I blame my wife asking me questions...
Reply With Quote
Благодарность от:
ozzy47
  #7  
Old 11-24-2014, 12:37 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, and sorry, but I should have done this instead of answering:

SH0CK,

You are currently showing up as unlicensed.

To be able to download modifications and/or receive support here at vBulletin.org, we ask you to please click here (vB-Germany users click here) and enter your email address. You will need to use your customer number and password (which will be in the email you got when you paid for your license) to access that page. Please note that your email is case sensitive.

To protect our customers privacy you will also need to Opt-In to license validation for all Support Sites. You must authorise vBulletin.org in order to validate your license status here. You can do this at the page linked above for your distributor. Make sure to set the permission to allow vBulletin.org to validate your status.

The update of your account can take up to one hour.

Thank you.
Reply With Quote
  #8  
Old 12-17-2014, 11:51 PM
SH0CK SH0CK is offline
 
Join Date: May 2007
Location: TN
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry it took so long to reply back. Had to get that pesky unlicensed thing to go away after updating my email addy here.

Thank you all for the point in the right direction. That SQL query is just the thing I was looking for. Now to work on using that info.

Thanks!
Reply With Quote
Благодарность от:
ozzy47
  #9  
Old 12-17-2014, 11:53 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well glad to see you sorted the unlicensed thing.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:24 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04023 seconds
  • Memory Usage 2,243KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (5)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete