PDA

View Full Version : how to access subscriptionlog table


porschegruven
10-29-2010, 05:23 PM
I would like to show a members paid subscription start date in the postbit. In order to do this I need to have access to the vbulletin.subscriptionlog table so I can select from the userid and regdate fields. I can't seem to connect to that table from an individual thread page.

At this point I'm writing a very simple plugin and trying to display it w/in postbit. The following code prints out fine w/in the thread template but the $sub_reg variable is empty.

$template_hook['postbit_userinfo_left'] .= 'Registered: '.$sub_reg.' MemID: '.$post[userid].'';

The problem is that my database connection is failing.

globals $vbulletin

$sub_result = $vbulletin->db->query_first("SELECT regdate, subscriptionid FROM subscriptionlog WHERE userid = 1 LIMIT 1");

$sub_reg = $sub_result['regdate'];

Is there an easier way for me to get the info I need from the subscriptionlog table? Does anyone have a simple idea why the connection is failing? I could setup my own php mysql connection but I'd rather not do that. I'd rather use vbulletin's database class.

--------------- Added 1288383728 at 1288383728 ---------------

I solved the connection issue. Duh! I had global(s). I'd still like to know if there's a variable already available to me so I don't have to do the db query.

Thnx.