Thread: Miscellaneous Hacks - VSa - PayPal Donate
View Single Post
  #850  
Old 11-28-2017, 01:52 AM
Peter Walker Peter Walker is offline
 
Join Date: Oct 2005
Location: Germany
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know I am late, yet I have only now moved my vB 3.8.9 forum straight to vB 4.2.5.

I have been using the similar Donate hack on vB3, so it made sense to install this one. It looks similar, but there are some differences and I found a pretty big bug - surprising nobody talks about it in 57 pages of comments. I did find a workaround for the bug as I will explain.

First of all, I compared the differences in what is sent to PayPal between the old and new version.
This mod adds the following to the url string sent to PayPal: &sra=1&src=1&srt=1

Seems harmless enough, until you try to submit a donation for one month. This results in the following error on PayPal:
"The link you have used to enter the PayPal system is invalid. Please review the link and try again."

As I knew that only three parameters had been added, I tested each of them until I found the problem: srt=1

PayPal defines that parameter as follows: "Specify an integer with a minimum value of 2 and a maximum value of 52."

Sure enough, as soon as I set srt=2, it worked.

As I did not want recurring subscriptions, I made some changes to the .xml file to get it to work as it did in the vB3 version. I also decided to set the locale to US as otherwise, my mainly US subscribers were being presented with a German PayPal page.

Find the following in VSa_PPDon.xml
Code:
			if(strstr($vbulletin->GPC['amount'],'|'))
			{
				$vsapp_get_amount = explode('|', $vbulletin->GPC['amount']);
				$vsapp_ppurl = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions';
				$vsapp_ppurl .= '&a3='.$vsapp_get_amount[0];
				$vsapp_ppurl .= '&p3='.$vsapp_get_amount[1];
				$vsapp_ppurl .= '&t3=M';
				$vsapp_ppurl .= '&no_note=1';
				$vsapp_ppurl .= '&sra=1';
				$vsapp_ppurl .= '&src=1';
				$vsapp_ppurl .= '&srt='.$vsapp_get_amount[1];
			}
			else
			{
				$vsapp_ppurl = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick';
				$vsapp_ppurl .= '&amount='.$vbulletin->GPC['amount'];
			}
Replace with:

Code:
			if(strstr($vbulletin->GPC['amount'],'|'))
			{
				$vsapp_get_amount = explode('|', $vbulletin->GPC['amount']);
				$vsapp_ppurl = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions';
				$vsapp_ppurl .= '&a3='.$vsapp_get_amount[0];
				$vsapp_ppurl .= '&p3='.$vsapp_get_amount[1];
				$vsapp_ppurl .= '&t3=M';
				$vsapp_ppurl .= '&no_note=1';
				$vsapp_ppurl .= '&lc=US';
			}
			else
			{
				$vsapp_ppurl = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick';
				$vsapp_ppurl .= '&amount='.$vbulletin->GPC['amount'];
				$vsapp_ppurl .= '&lc=US';
			}
In this change, I have completely removed the "&sra=1&src=1&srt=1" and added "&lc=US" to the string sent to PayPal. This makes all donations one-time, as it was in vB3, and ensures that all sponsors land on an English PayPal language page.

I find this works better for me and avoids the error for one month subscriptions. I also found that PayPal will show an error for any subscriptions longer than 24 months, so avoid that.

What I would really like, is an option to have this mod make use of the original vBulletin PayPal subscription system. Then a two month subscription could actually add the donor to the specified VIP group for those two months and then automatically remove the subscription to that usergroup, when the subscription expires. I do that manually, but it would be great if that possibility could be added to this mod. Is perhaps Valter, or someone else, up to the challenge?

I have attached my modified .xml file, in case anyone here finds it useful.
Attached Files
File Type: xml VSa_PPDon.xml (86.5 KB, 10 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01208 seconds
  • Memory Usage 1,802KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete