![]() |
Gift Subscriptions
Looks like there was a huge need for a gift subscription hack, so I created one, attached. It allows users to extend or purchase board subscriptions for other users.
This has been implemented and tested on our boards, but it is in EARLY ALPHA! Please provide me with feedback/questions after you implement it. Should take about 15 minutes to complete. 1. Create 1 plugin 2. Modify 2 templates 3. modify 1 script (payments.php) -- PLEASE backup and save your old script for upgrade purposes. Let me know how it goes! ~ Jennifer |
What's the purpose of this hack?
|
So users can purchase subscriptions for other users (not just themselves).
|
like a check :D
|
I realized Pig's hack was in the graveyard recently, and I didn't have a backup. This is really appreciated, thanks.
|
This is fantastic, thank you! <3
|
Quote:
|
This is just one of the many things that would really make the subscriptions really great, if vbulletin had it in default.
Thanks for sharing :) |
How does this work? Does it add a link under the paid subscriptions? Anyone have a demo or screen shot?
SVT |
Very nice idea. Great job!
|
User goes to their CONTROL PANEL and then clicks on PAID SUBSCRIPTIONS (which you have to have enabled and set up already).
It defaults to the user's username, but they can enter another member's username as a gift subscription. The rest of the checkout goes through normally. The recipient is NOT notified. That is up to the gifter or the moderator. Some gifters want to remain anonymous. |
Nice hack, thank you :)
I think a nice addition would be the ajax type 'auto-fill' feature (ie that found in the PM and search) which finds the correct username as your typing. Are there plans to modify for vB3.7 ? Cheers, Adam |
Thank you! :)
|
I think you need to account for a table prefix in the file hack part of the mod.
|
Quote:
The hack works great. |
Quote:
|
Quote:
|
Thanks
|
testing it on 3.5.4 soon
*edit* - gave me an error message on 3.5.4 - I am upgrading to 3.7 in a few weeks - will try again.. Do you know what will happen if the user already has the subscription? Will it be able to tell the user already has it and give the attempted gifter that message? Also would be nice to have the option to be anonymous or not, and send some sort of text message with the gift, either from anonymous or from the real user.. |
This works well with 3.6.8 patch level2. The only issue I have with it is that when someone enters a typo in the username field or types something like 'happy birthday kether' instead of just 'kether', they get a database error. I tried to figure out how to capture the error and redirect them back to the subscription page to correct the mistake, but I am not a programmer. The problem comes with the userid of the recipient if their name is typed wrong or if it doesn't exist.
My solution would be to send them to a page that automatically redirects back to the subscription page after they had time to read a short messsage that says again: "Please type only the username of the member for which you would like to purchase a gift subscription " Anyone have any way to do that? -K |
I wouldn't have even noticed. And my members are dumb enough to do this.
Find in payments.php: Instead of (as provided) Code:
//=== HACK: GIFT SUBSCRIPTIONS ===// ("Invalid recipient username. Please press the back button, enter the correct username and try again. <u>Click Here to See the Members List</u>"): Code:
//=== HACK: GIFT SUBSCRIPTIONS ===// |
I notice after upgrading to 3.6.9 the upgrade gets added to the person
buying the gift subscription as opposed to the person who should be receiving the gift. |
Woops... Nevermind it seems payments.php got overwritten during the upgrade. :rolleyes:
I had to reinsert the hacks back in. :D |
Okay, total newbie question, but how do I create a plug in for this?
|
oh never mind -- it's in the Plug in section of the Admin area.
|
In case anyone was wondering this hack works great in 3.7 RC4 :up:
|
Diesel this work on 3.7.4 ?
|
3.8.3?
|
I tried inserting this into the brand new 3.8.4 and got an error message when I tried to execute a paid subscription, saying:
Database error in vBulletin 3.8.4: Invalid SQL: INSERT INTO paymentinfo (hash, completed, subscriptionid, subscriptionsubid, userid) VALUES ('0d336f6ad3eff6f2f898922e6eaeec2b', 0, 1, 1, ); MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4 Error Number : 1064 Request Date : Wednesday, August 12th 2009 @ 12:33:06 PM Error Date : Wednesday, August 12th 2009 @ 12:33:06 PM Script : http://forums.escapeallthesethings.c...s.php?do=order Referrer : http://forums.escapeallthesethings.com/payments.php IP Address : 190.241.15.100 Classname : vB_Database MySQL Version : 5.0.67-log I am attaching my payments.php in case anyone can see if I did it wrong |
Quote:
|
Thanks, good point. Except when I did the search and replace, the code that I found matched exactly what was supposed to be there.
Can you recommend how to handle this? I really want this plugin. Shall I ask the original poster if they have this working still on their forums and using 3.8 now? |
Quote:
|
OK, I confess I rechecked and found a wrong insertion point for the subscription template. It works now, with 3.8.4.
|
Hi,
can You explain what exactly is to do? Thanks! Quote:
|
Hello,
i installed this AddOn in version 3.8.4. There was 1 thing wrong in the payments.php do NOT add after: ($hook = vBulletinHook::fetch_hook('paidsub_order_start')) ? eval($hook) : false; i added it after: if ($_POST['do'] == 'order') { //=== HACK: GIFT SUBSCRIPTIONS ===// if ($_POST['giftname'] != $vbulletin->userinfo['username']) { $goo=$db->query_read_slave("SELECT userid from ". TABLE_PREFIX ."user where username='".$_POST['giftname']."'"); if ($giftee = $db->fetch_array($goo)) { $subid = $giftee['userid']; $subusername = $_POST['giftname']; } else { eval(standard_error(fetch_error('pminvalidrecipien t'))); } } else { $subid = $vbulletin->userinfo['userid']; $subusername = $vbulletin->userinfo['username']; } //=== HACK: GIFT SUBSCRIPTIONS ===// Then i modified the template: subscription_payment locate: <td class="panelsurround" align="center"> <div class="panel"> <div align="$stylevar[left]"> AFTER that, add: <div class="fieldset"> Subscription for: <strong>$subusername</strong> </div> Ok, so it works Martin |
Anyone got the updated instructions to get this working for VB4? Many of the code syntax is now changed for the variables manipulated for the GIFTNAME...but I have not learned the new syntax yet.
|
i would also be interested in this for VB4
|
I'd love to see this implemented into vB4 too, I don't know why it's not a core feature tbh.
|
My team updated this for 4.0.2
https://vborg.vbsupport.ru/showthread.php?t=237351 Thanks for the original mod jamoss! |
Any ideas how to fix it so that "special" names work?
For example: <[X]> will not work as an accepted username. What do I need to edit in order for this mod to support special characters? Fixed: Replace: $goo=$db->query_read_slave("SELECT userid from ". TABLE_PREFIX ."user where username='".$_POST['giftname']."'"); With: $sqlname = htmlspecialchars($_POST['giftname']); $goo=$db->query_read_slave("SELECT userid from ". TABLE_PREFIX ."user where username='".$sqlname."'"); |
All times are GMT. The time now is 06:08 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|