I'm redesigning the template for a Wordpress based site which is bridged with a vBulletin forum. How can I开发者_运维技巧 can I get the number of online users as they are shown on the forum's pages so that I can insert them in another page? Is there some sort of API to interact with?
As of vBulletin 3.8.4 there's no API for getting this information that I know of.
I see two relatively straightforward options for solving this problem:
- Query the vBulletin database the same way vBulletin does. If you have a look inside forumdisplay.php and search for 'showforumusers' you'll see the code they use.
- Use memcached. Hack forumdisplay.php to cache the number of users viewing that forum and then read that out from Wordpress. If vBulletin is already set up to use memcached, you can access the Memcache object at
$vbulletin->datastore->memcache
. Just make sure you call$vbulletin->datastore->connect();
before using it.
Option 2 is probably the better bet unless your site & blog are quiet.
I've never dealt with vBulletin, but just searching Google for "vbulletin api" brings me here: http://members.vbulletin.com/api/
Another search for "vbulletin api online users" will result in this: http://www.vbulletin.org/forum/showthread.php?t=57810
I guess you can take whatever it needs from there ...
精彩评论