Extension:VBulletin stats

WARNING: Some of the information on this page refers to a site that was username/password restricted. Fortunately the source code could be recovered from the Internet Archive Wayback Machine. Excellent illustration of why code should be hosted on google code, sourceforge or similar.

Description
Note: the most up-to-date version of this extension will be on my wiki. I wanted to incorporate my vBulletin forum statistics into my wiki page(s). So I looked into creating an extension and came out with this - the vBStats extension. It retrieves an array of data from your vBulletin database and displays it according to conditions you supply (a list of conditions is below).

This hack has been tested on the following vBulletin and MediaWiki combinations;

Demo
You can see a demonstration of this extension in action here. (password protected now)

Installation
To install the script, first copy the source code below, save it to a file named 'vbStats.php' and upload it to yourwiki/extensions/

Next, put the following code at the bottom of your localSettings.php file:

include("extensions/vbStats.php");
 * 1) include vBStatsExtension

Finally, change these values in vbStats.php;

$server = "localhost"; # if you don't know what this is just leave it as localhost $username = "username"; # your MySQL username $password = "password"; # your MySQL password $forumdb = "forum"; # your forum MySQL database name $wikidb = "wiki"; # your wiki MySQL database name $maxThreadLimit = 10; # max number of threads to show $maxUserLimit = 10; # max number of users to show $forum_url = "http://www.yourwebsite.com/forum"; # your forum url - DO NOT put an ending forward slash on (site.com/forum/ <-WRONG)
 * 1) EDIT THESE VARS ###########
 * 1) /EDIT THESE VARS ###########

Options
To use the script, simply put the following tags in a mediaWiki article;

 limit=[number] sort=[ASC,DESC] order by=[date,title,rand] 

 limit=[number] sort=[ASC,DESC] order by=[posts,joindate,username,rand] 

 show total posts=[true,false] show total threads=[true,false] show total members=[true,false] show largest thread=[true,false] show most popular thread=[true,false] show most popular forum=[true,false] 

 show active users=[true,false] show inactive users=[true,false] show sub-heading=[true,false] show last 30 days=[true,false] show last 14 days=[true,false] show last 7 days=[true,false] 

Example
 limit=5 sort=DESC order by=date 

Support/Requests
Please post any questions or requests (additions to the script you would like) on the vBulletin Stats extension page on my wiki. I rarely check the wikiMedia website.