vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Is there a way to show total registered members outside VB? (https://vborg.vbsupport.ru/showthread.php?t=284109)

rguan 06-07-2012 01:55 PM

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

rguan 06-10-2012 04:33 AM

Anyone can help on this?

kh99 06-10-2012 08:31 AM

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.

rguan 06-10-2012 08:43 AM

Thanks for reply, could you give a full code solution?

kh99 06-10-2012 08:48 AM

Do your custom pages use vbulletin code at all?

rguan 06-10-2012 08:52 AM

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...

kh99 06-10-2012 09:04 AM

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?

rguan 06-10-2012 09:22 AM

"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 :-)

kh99 06-10-2012 09:23 AM

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();




All times are GMT. The time now is 01:13 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.01042 seconds
  • Memory Usage 1,736KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete