Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2012, 01:55 PM
rguan rguan is offline
 
Join Date: Sep 2011
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Is there a way to show total registered members outside VB?

Hello everyone,

I'm running my business site with custom PHP pages + vBulletin 3.8.7, I want to display the vBulletin total registered members on my custom PHP homepage, is there a way to implement this?

This is my first thread on vb.org... hope I can get solutions from some great guys! :-)

Thanks a lot!

Roy
Reply With Quote
  #2  
Old 06-10-2012, 04:33 AM
rguan rguan is offline
 
Join Date: Sep 2011
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone can help on this?
Reply With Quote
  #3  
Old 06-10-2012, 08:31 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could connect to the vb database and execute this query:

Code:
SELECT * FROM datastore WHERE title='userstats'

The result will be one record where the 'data' column is a serialized array with 4 values: numbermembers, activermembers, newusername, and newuserid.
Reply With Quote
  #4  
Old 06-10-2012, 08:43 AM
rguan rguan is offline
 
Join Date: Sep 2011
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for reply, could you give a full code solution?
Reply With Quote
  #5  
Old 06-10-2012, 08:48 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do your custom pages use vbulletin code at all?
Reply With Quote
  #6  
Old 06-10-2012, 08:52 AM
rguan rguan is offline
 
Join Date: Sep 2011
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope. Actually it's a blank PHP page... that's why I find it hard to work out...

Could you help on this? MANY MANY thanks...
Reply With Quote
  #7  
Old 06-10-2012, 09:04 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, one thing you could do is to do something like in this article: https://vborg.vbsupport.ru/showthread.php?t=228112 . Then if you were to change the $specialtemplates line like this:

Code:
$specialtemplates = array('userstats');

you should be able to use $vbulletin->userstats in the custom code. But that's a lot of overhead if all you want is those two numbers. You say the page is blank - what is the page for? What else will be on the page when you're done?
Reply With Quote
  #8  
Old 06-10-2012, 09:22 AM
rguan rguan is offline
 
Join Date: Sep 2011
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

"Blank" actually means it has nothing to do with VB initially... It looks like I have to do a lot of custom coding to get the "active members"...

Anyway, thanks a lot for your kind responses :-)
Reply With Quote
  #9  
Old 06-10-2012, 09:23 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think it's that much, I was just trying to understand what the situation is. Give me a few minutes...

OK, hopefully this helps:

PHP Code:
// you may need to adjust this path if your custom php 
// isn't in the forum directory.
include('./includes/config.php');

$server $config['MasterServer']['servername'];
if (!empty(
$config['MasterServer']['port']))
    
$server .= ':' $config['MasterServer']['port'];
    
if (
mysql_connect($server$config['MasterServer']['username'], $config['MasterServer']['password']))
{
    
mysql_selectdb($config['Database']['dbname']);
    
$result mysql_query("SELECT * FROM " $config['Database']['tableprefix'] . "datastore WHERE title = 'userstats'");
    if (
$result AND ($row mysql_fetch_assoc($result)))
    {
        
$vals unserialize($row['data']);
        echo 
"Forum has " $vals['numbermembers'] . " registered members";
    }
    
mysql_close();

Reply With Quote
Reply


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 12:53 AM.


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.03775 seconds
  • Memory Usage 2,242KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_code
  • (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
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete