PDA

View Full Version : Showing vBulletin Stats Externally


DaPro
07-18-2009, 07:14 PM
Hi,

I am looking for a plugin compatibile with 3.8.3 that will show basic stats for your forum like total threads, total posts, registered members, users online, etc. Is there anything currently or would anyone mind sharing a script that works? I found this on the forum but it doesn't work:

$specialtemplates = array(
'userstats',
);

chdir("./community/");
require_once("./global.php");
require_once("./includes/functions_forumlist.php");
chdir("../");

// Forum Stats
cache_ordered_forums(1);

$totalthreads = 0;
$totalposts = 0;
if (is_array($forumcache))
{
foreach ($forumcache AS $forum)
{
$totalthreads += $forum['threadcount'];
$totalposts += $forum['replycount'];
}
}
$totalthreads = vb_number_format($totalthreads);
$totalposts = vb_number_format($totalposts);
$userstats = unserialize($datastore['userstats']);
$totalmembers = vb_number_format($userstats['numbermembers']);

Anyone who could help would be amazing :)!

Lynne
07-18-2009, 07:48 PM
That code looks like the stuff from the bottom of the index.php page. I think it should work on another page assuming the paths for the files are correct. You have stated nothing about where you want to use these stats and what the code on that page looks like or where it is in relation to your forums, so I can't comment on whether your paths are correct.

DaPro
07-19-2009, 01:53 AM
Sorry Lynne, this should be going onto a normal external non-vb page. The paths are correct, but when I try to apply the code and echo the variables it shows "0" for everything. Not sure why...this code is old though.

Lynne
07-19-2009, 03:59 AM
Sorry Lynne, this should be going onto a normal external non-vb page. The paths are correct, but when I try to apply the code and echo the variables it shows "0" for everything. Not sure why...this code is old though.
Take a look at the bottom of the index.php page and you'll see what the current code is.

ultimatearco
08-06-2009, 09:15 PM
If the file is in a different directory to vbulletin you may need to include relevant files such as config.php, this can be done with the following:

<?
include('forumdir/includes/config.php');
?>