View Full Version : Pig's Subscription Gift

17 Jan 2006, 06:59

Allows users to pay for a paid subscription for another user.

Five plugins
One new template
Three new phrases
Three template edits


Install the product XML through the product manager.

Edit template 'subscription' in 'Paid Subscriptions Templates'.

<if condition="$show['activesubscriptions']">
Insert before that, this code:
<input type="hidden" name="do" value="order" />
Insert after that, this code:
<if condition="$giftuser != null">
<input type="hidden" name="gift" value="$giftuser[userid]" />

This step may be altered according to taste. I chose to insert the link that userA would click to pay for userB into userB's profile, i.e. MEMBERINFO, but it could just as easily be put in 'postbit'. Anyway...

Edit template 'MEMBERINFO' in 'Member Info Templates'.

<td class="vbmenu_control">
<if condition="$show['addbuddylist']">
Add before that, this code:

<td class="vbmenu_control">
<a href="payments.php?$session[sessionurl]gift=true&userid=$userinfo[userid]"><phrase 1="$userinfo[username]">$vbphrase[buy_x_a_sub]</phrase></a>

And you're done.


Active subscriptions are never shown on the paid subscriptions page, either for the donor or the recipient, when visiting the paid subscriptions page through the gift subscription link.
The identity of the donor is not revealed to the recipient. An admin will have to check out the payment info if the recipient wants to know who gave them the subscription.


screen1.png: Member profile page containing link to subscription gift page
screen2.png: Subscription page showing that the user is about to pay for someone else

17 Jan 2006, 07:05
this mod looks cool..

17 Jan 2006, 11:52
Yeah definitely very nice! Thanks. :D

17 Jan 2006, 12:05
really, i can't imagine to live without it now that it exists... lol

damn this is a good idea for a sharing community!

17 Jan 2006, 12:57
Superb idea!!

17 Jan 2006, 14:51
very nice mod.. any chance we can get it in a plugin? (very lazy admin here)

17 Jan 2006, 15:00
Umm. It is a plugin. Plugins can't modify templates though, so manual template changes are always going to be required.

17 Jan 2006, 16:19
Awesome. I'll probably install this tonight! ;)

Reeve of shinra
17 Jan 2006, 16:24
Great idea!

17 Jan 2006, 18:42

I have installed and clicked install...

I get this error now when i got my donations page????

Warning: Division by zero in /includes/functions.php(4320) : eval()'d code on line 10

Any ideas please?

17 Jan 2006, 18:52

I have installed and clicked install...

I get this error now when i got my donations page????

Warning: Division by zero in /includes/functions.php(4320) : eval()'d code on line 10

Any ideas please?
Hmm line 4320 says...
($hook = vBulletinHook::fetch_hook('global_complete')) ? eval($hook) : false;
... so what code is in your global_complete hooks?

17 Jan 2006, 19:11

the only 1 that is enabled is the Realtime Template Compressor
and this is the code for it, the other 2 are disabled so i have not mentioned them....

//Logician Hack:
$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);


$output = str_replace('</body>', '<center><span class="smallfont">[Output: ' . $page_kilobyte . ' Kb. compressed to <b>' . $pagenew_kilobyte . '</b> Kb. by saving <b>' . $pagesaved_kilobyte . '</b> Kb. (' . $pagesaved_perc . '%)]</span></center></body>', $output);
//Logician Hack:

17 Jan 2006, 19:13
I have just disabled this compressor and i dont get the error any more, although my donations page still does not show..... :(

17 Jan 2006, 19:14
Does this error go away when you disable or uninstall my product?

17 Jan 2006, 19:23
I think i have resolved it, I had upgraded VB earlier last week and i need to redo a few things :(

17 Jan 2006, 19:42
Sorry about that m8, I panicked thinking it was when i installed you hack as i had not checked the donations page latley and once i had installed yours i then checked the page and obviously it was not working as i had upgraded VB, hence i assumed it was your hack....

My oplogies m8...Yours is installed and working well...
Great hack, keep up the good work..

Sorry again for the false alarm :o

05 Mar 2006, 02:21
great hack, will it work for 3.5.1?

05 Mar 2006, 04:52
Will this work in 3.5.4?

08 Mar 2006, 21:09
Is this working for people with 3.5.4 as it is? My members when they use this seem to get the subscription go back to their own accounts.

08 Mar 2006, 21:56
i'd like add this too if its 3.5.4 ready ? ? ?

09 Mar 2006, 02:03
Okay, I got this working with 3.5.4. Install the hack as it is, but make sure you do this:

DISABLE this plugin:
Hook Location : paidsub_order_paymentbit
Pig's Subscription Gift (4)

If you don't, the donation will still go to the donating member, not the other member. To be honest, I'm not sure why it's there in the first place as it removes the effect of the previous code.

13 Mar 2006, 18:20
Thanks for the fix, I just installed and didn't have to experience that. :)
Is there a certain if statement that we could surroud the memberinfo code to only show if the profile isn't already a subscriber? In other words if they are paying no need to have this link, but I'm not sure how.

16 Mar 2006, 21:58
After installing this hack, I click on the link provided in a profile and I'm brought to where you select which subscription to buy. I select the one I want, hit submit, and it reloads the subscription page but with this error on the top:

Warning: Invalid argument supplied for foreach() in /includes/functions_user.php on line 50

If I try to buy a subscription by not going through the 'buy this person a subscription' link, then I don't get that error message and it appears to work correctly.

My script has been customized by an external coder so I was thinking that is what caused the error. However when I view an original file I see that not much in that file has changed and line 50 is the same either way.
This is line#50 on either:
foreach ($vbulletin->userinfo['forumpermissions'] AS $forumid => $perm)
Anyone have any idea what's causing this?

The only thing that I've done is what Erwin recommended above by disabling that particular plugin that he specified. I've done nothing else.

16 Mar 2006, 22:03
Ok, I just for the hell of it re-enabled the plugin that Erwin said to disable and the error message went away. :) Now I'm wondering though, Erwin said the subscription goes to the buyer not the person it's intended for. I guess I could setup a paypal developer account and test this out but I haven't looked into that yet. :( haha

Has anyone else experienced the problem that Erwin was having? I am running 3.5.4 as well, but like I said re-enabling the plugin that Erwin said to disable got rid of the above error message.

23 Mar 2006, 01:28
Ok I can't seem to test this out because I can't send my own paypal account money. Does this work for recurring, in other words if I want to pay for someone elses subscription and I choose a recurring one then my paypal account will be the one billed each month but each month the other person will get the credit right? Any more info on what Erwin was saying?

flfooty tv
23 Mar 2006, 10:39
awsome mod! love it

24 Mar 2006, 18:10
Can anyone show this noob how to put this in postbit legacy? :)

26 Mar 2006, 06:28
btw this is such a cool hack. :) I am nervous since Erwin said to disable a plugin and doing so caused an error message. I am going to just trust the lack of problems reported and see what happens. Thanks again.

16 May 2006, 09:40
Seems like this is another abandoned hack.

22 May 2006, 23:24
I can't get it to work in postbit. It drops the userID:

"invalid userID specified"

When I disable the plugin, it follows the link to paid subscriptions, but I don't think that it is paying for another user...

24 May 2006, 03:07
Replying to my own post:

Fixed (I think)
<td class="vbmenu_control">
<a href="payments.php?$session[sessionurl]gift=true&userid=$userinfo[userid]"><phrase 1="$userinfo[username]">$vbphrase[buy_x_a_sub]</phrase></a>


<td class="vbmenu_control">
<a href="payments.php?$session[sessionurl]gift=true&userid=$post[userid]"><phrase 1="$userinfo[username]">$vbphrase[buy_x_a_sub]</phrase></a>

The string "userinfo[userid]" wasn't working so I changed it to "post[userid]"

I need to get one of my users to gift another one to test it.

25 May 2006, 08:01
The available subscriptions does not show up. Any thoughts? I'm running 3.5.4

27 May 2006, 10:14
It looks like it was abandoned.

15 Jul 2006, 20:18
Any 3.0x version of this able? We havent had a chance to upgrade yet.

18 Jul 2006, 10:07
In what case do people use this? Never knew people would pay for someone elses' subscription?

Very curious

24 Jul 2006, 04:46
In what case do people use this? Never knew people would pay for someone elses' subscription?

Very curious

Say like on our forums. http://forums.qj.net its LARGE, dedicated, mostly PSP users.

Needless to say.. "Kids" under 18. The option to buy someone else a 3$ gift.. is nothing to the 18+ users if they like the person.. thus being able to buy a membership for someone else helps. =)

14 Aug 2006, 20:14
Anyone running this on 3.6.0? I could really use this mod. :)

14 Aug 2006, 22:29
Anyone running this on 3.6.0? I could really use this mod. :)

12 Sep 2006, 23:02
Anyone running this on 3.6.0? I could really use this mod. :)


14 Sep 2006, 01:07
Yup. I'm running it on 3.6.0 and having no problems.

25 Oct 2006, 05:04
Just installed this on 3.6.2. No problems, everything seems fine. Nice Job.

26 Dec 2006, 18:05
anyone running it on 3.6.4?

30 Dec 2006, 13:53
We're running it on 3.6.4 All is fine. :)

01 Jan 2007, 13:29
I'm trying this out too, hoping someone will pick it up and maintain long term though ^^ I can't believe this isn't standard in vB.

02 Jan 2007, 13:46
Installed and running fine on 3.6.4, and confirmed to work by our users.

27 Jan 2007, 05:26
Hey side question.. is there a way to ENSURE that gift subscriptions do not "Auto Renew"? I mean I know I could make a new set of options.... however that would allow everyone to select a subscription that doesnt auto renew. I just want it to ensure users who buy a gift sub do not get auto renewed for giving a gift. Is there a way to check for that and have forums tell paypal not to setup auto renews for gift sub purchases without setting up or disabling auto renew on vb admincp paid subscription settings?

28 Jan 2007, 12:47
When I told my members our board was going paid they screamed for this feature! It installed beautifully and seems to be working fine! Thank you so much! :up:

03 Feb 2007, 00:28
Easy install, works perfectly. This is excellent! Thank you.

05 May 2007, 19:06
Where are the files?

08 May 2007, 20:22
Sorry but where is the XML file?