PDA

View Full Version : Hooks and variables after paid subscription complete


nighteyes
03-12-2008, 10:48 AM
Hi!

I need some help from a vBulletin programming god!

I'm working on a fairly simple plugin that will send a private message to users who subscribe to one particular subscription plan in vBulletin.

The subscription has the ID of 3.
The usergroup ID users get moved after subscription is 9.

So I've decided the best way to do this is check the usergroup ID after their payment is complete.

I've chosen this hook:
paidsub_build

And the code:
<phpcode><![CDATA[if ($user['usergroupid'] == 9)
{
---CODE GOES HERE IF TRUE----
}]]></phpcode>

This isn't working for whatever reason. I guess the variable I'm trying to check is not valid, set or available from within the hook.

Should I use a different hook location? Which one?
And which variable should I check (i.e. $newusergroupid == 2)?

I'd be so grateful if someone could give me some hints on what I'm doing wrong. This is really driving me insane today.

MoT3rror
03-12-2008, 07:29 PM
$vbulletin->userinfo['usergroupid']

Antivirus
03-12-2008, 08:07 PM
I think what you want is something like:


if ($currentsubscription['subscriptionid'] == 3)
{
code here
}


Since the subscription you're talking about always changes the user's usergroup to 9, there's no need to check the usergroupid - check the subscriptionid instead.

nighteyes
03-13-2008, 07:13 AM
Thanks for the advise. I've given up on this, I can't even get the private message to send - let alone concern myself with checking the usergroup or subscription ID.

If anyone is interested in coding this for me, I've posted a paid work request here:
https://vborg.vbsupport.ru/showthread.php?t=172882

As I posted in the above link, you'll find plenty of code around already to get this job done. I'm willing to pay a premium if someone has the time to get this done today. :)