views:

149

answers:

2

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?

A: 

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

Select0r
That message is 7 years, and two major versions, old.
kemp
Well, the API-link isn't ...
Select0r
+2  A: 

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:

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

Conor McDermottroe
This is interesting, I'll have to use memecache anyway very soon due to load
kemp
Yeah, we've bodged in some use of memcache there and a few more places to supplement what vBulletin already does. Anything which queries the session table is worth examining for cache-ability since MySQL's query cache won't help much.Also, if you have very long threads, this horrible dirty hack may be useful: http://www.mcdermottroe.com/blog/2009/10/23/more-bodges-more-speed/
Conor McDermottroe