-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PayPal IPN URL and WordPress URLs when Permalinks are set to "Plain" #20063
Conversation
(Standard links)
|
Thanks @christianwach - I glazed over when I got to the wordpress bit but the approach in terms of how the url functions are called looks good |
@eileenmcnaughton Thanks for the feedback on the general approach. I can see that the diff on |
Thanks @christianwach - I expect @jusfreeman will be keen to review this |
3521f9a
to
cd95cfb
Compare
Morning / Afternoon / Evening @christianwach I've tested this using PayPal Express as that's the PayPal method used for our customers. Using CiviCRM 5.36.1. When the payment is processed, the return page in CiviCRM is the confirmation page. Despite the option "Use a confirmation page?" being disabled. Once you click on the "Make contribution" button, payment is then confirmed. However this should not be required at all. Any ideas? Agileware Ref: CIVICRM-1668 |
@agileware-justin I can't reproduce this with the patch on 5.35.1. Works as expected without the Confirmation Page, i.e. redirect to PayPal happens, then back to the Private Page with the Thank You content. IPN completes successfully. Perhaps your issue is unrelated? |
@agileware-justin Also tested with patch on vanilla WordPress 5.7.1 & CiviCRM 5.36.1. Works as expected without the Confirmation Page. Suspect your issue does not relate to this PR. Can you replicate with a vanilla install? FWIW, this PR doesn't touch any of the code related to the page flow. |
@christianwach "Private" Page: Can you define? is that a WP Private page (only visible to site admins and editors), password protected or a page restricted by some other method (Plugin restricted content such as groups, members, etc) I am trying to determine how best to test this. |
@kcristiano You can test by setting the Post Status of the Page to "Private". Doesn't really matter TBH, the key is that wherever the Shortcode is the IPN URL always points to the Base Page. |
Confirming use cases:
|
@christianwach @kcristiano I think the review by @agileware-fj green lights this for merge (thanks all!) - just checking that there is nothing outstanding from your end |
@eileenmcnaughton I am OK with it. I spoke to @christianwach last week and the improvement of having the IPN always go to the base page is a great improvement. I think it'd merge-ready based on @agileware-fj 's review |
OK - if you 3 think it's good then I'm happy! |
Overview
This was meant to be simply a fix for this issue on Lab, but in the process of creating that fix, it became evident that a deeper dive into WordPress URLs was necessary to untangle what was needed.
Before
After
Technical Details
This PR does a few things to achieve its ends:
getNotifyUrl()
family of methods to theCRM_Utils_System*
classes so that the PayPal IPN URL always targets the WordPress Base Page.CRM_Utils_System_WordPress::getBasePageUrl()
in order to build URLs that target the WordPress Base Page when in a Shortcode context.CRM_Utils_System_WordPress::url()
because WordPress URLs were broken when Permalinks are set to "Plain". SinceCRM_Utils_System_WordPress::getNotifyUrl()
is a stripped-down version ofCRM_Utils_System_WordPress::url()
that needs to respect both (a) Permalink settings and (b) whether Clean URLs are used, it became necessary to auditCRM_Utils_System_WordPress::url()
in order to strip it down!CRM_Utils_System_WordPress::getBaseUrl()
a public method so that the duplicate method in the CiviCRM-WordPress plugin can be removed.Comments
I'm opening this PR against
master
so that there's plenty of time to evaluate the changes toCRM_Utils_System_WordPress::url()
in particular.Many thanks to Agileware who part-funded this PR.