strangerstudios / pmpro-donations Goto Github PK
View Code? Open in Web Editor NEWAllow customers to set an additional donation amount at checkout with Paid Memberships Pro.
Home Page: https://www.paidmembershipspro.com/add-ons/donations-add-on/
Allow customers to set an additional donation amount at checkout with Paid Memberships Pro.
Home Page: https://www.paidmembershipspro.com/add-ons/donations-add-on/
=== Paid Memberships Pro - Donations === Contributors: strangerstudios Tags: paid memberships pro, pmpro, membership, donate, donations, gifts, charity, charities Requires at least: 4 Tested up to: 6.4 Stable tag: 2.0 Allow customers to set an additional donation amount with customized minimum, maxium, and suggested amounts via dropdown at checkout. == Description == This plugin requires Paid Memberships Pro. == Installation == 1. Upload the `pmpro-donations` directory to the `/wp-content/plugins/` directory of your site. 1. Activate the plugin through the 'Plugins' menu in WordPress. 1. Edit the levels you want to add donations to and set the "Donation" settings. == Frequently Asked Questions == = I found a bug in the plugin. = Please post it in the issues section of GitHub and we'll fix it as soon as we can. Thanks for helping. https://github.com/strangerstudios/pmpro-donations/issues == Changelog == = 2.0 - 2024-03-08 = * FEATURE: Donation levels can now have a "donation confirmation message" that will be shown on the confirmation page after a user donates. #64 (@MaximilianoRicoTabo) * ENHANCEMENT: Order donation amounts are now stored in order meta. #66 (@MaximilianoRicoTabo) * ENHANCEMENT: Added a new panel for "Donations Settings" when editing a membership level. #65 (@MaximilianoRicoTabo) * ENHANCEMENT: Added the `pmpro_alter_price` class to donation fields at checkout to detect when the checkout level price changes. #70 (@MaximilianoRicoTabo) * BUG FIX/ENHANCEMENT: Improved the sanitization of some `$_REQUEST` variables. #68 (@MaximilianoRicoTabo) * DEPRECATED: Donation amounts are no longer stored in order notes. Existing donation data in order notes will be gradually migrated to order meta as the donation data is accessed. #66 (@MaximilianoRicoTabo) = 1.1.3 - 2023-09-06 = * BUG FIX: Fixing issue where donations would not be charged when using the PayPal Express gateway. #63 (@dparker1005) = 1.1.2 - 2023-08-15 = * ENHANCEMENT: Added a new filter `pmpro_donations_invoice_bullets` to filter the bullet points that are added to the PMPro Invoice page. #55 (@MaximilianoRicoTabo, @dparker1005) * ENHANCEMENT: Now wrapping the donation prompt text at checkout in a `<span>` tag so that it can be styled with CSS. #39 (@elementswebsolutions) * ENHANCEMENT: Updating `<h3>` tags to `<h2>` tags for better accessibility. #50 (@ipokkel) * ENHANCEMENT: Now preventing autocompletion of donation field at checkout. #45 (@MaximilianoRicoTabo) * BUG FIX/ENHANCEMENT: Fixing paragraph spacing issues with custom help text by switching to using `wp_editor()`. #58 (@dparker1005, @MaximilianoRicoTabo) * BUG FIX/ENHANCEMENT: Now always allowing users to renew a donations-only level. #60 (@dparker1005) * BUG FIX: Added delimiters to regular expressions. Fixes issue where donation inputs may be ignored if non-numeric characters were included. #47 (@becleung) * BUG FIX: Fixing issue where payment fields may not show if a non-zero donation dropdown option is selected. #59 (@dparker1005) * BUG FIX: Now correctly sending the “Checkout - Paid" email template if a non-zero donation was added to a free level at checkout. #61 (@dparker1005) * BUG FIX: No longer storing donation amounts in `$_SESSION` which was causing issues on some sites. #36 (@MaximilianoRicoTabo) * REFACTOR: No longer pulling the checkout level from the `$_REQUEST` variable. #46 (@dparker1005) * REFACTOR: Now using the function `get_option()` instead of `pmpro_getOption()`. #48 (@michaelbeil) = 1.1.1 - 2020-08-12 = * BUG FIX: Resolved issue where !!donation!! email variable would not be replaced if user did not donate. = 1.1 - 2020-08-12 = * FEATURE: Added !!donation!! email template variable. * BUG FIX/ENHANCEMENT: Now only starting sessions on checkout page, which resolves warning from Site Health tool. * BUG FIX/ENHANCEMENT: Now properly stripping slashes in donation "Help Text" setting. * BUG FIX/ENHANCEMENT: Resolved PHP notice when loading the checkout page with 'Other' as a dropdown donation option. * BUG FIX/ENHANCEMENT: Resolved PHP warning when loading a level's donation settings for the first time. = 1.0 - 2020-04-09 = * FEATURE: Added "Donations-Only Level" option. * BUG FIX: Fixed bug where donation was not being added to order notes. * BUG FIX: Now correctly hiding 'Other' option in donation dropdown menu if 'Other' is not allowed. * BUG FIX: Fixed regular expression in pmprodon_getPriceComponents(). * BUG FIX/ENHANCEMENT: Fixed some strings that were using the wrong text domain and added translation files. * REFACTOR: Organized code into separate files. = .5 = * BUG FIX: Making sure session is started before interacting with session vars. * BUG FIX: Keeping billing address fields visible when switching to pay by check option. * BUG FIX: No longer allowing negative donations if a minimum value wasn't set. * ENHANCEMENT/FIX: Wouldn't always substitute text properly when translated * ENHANCEMENT/FIX: PHP Warnings during checkout * ENHANCEMENT: Improved fields display on membership checkout page to use no tables for compatibility with Paid Memberships Pro v1.9.4. = .4 = * ENHANCEMENT: Layout improvements to donations field on membership checkout. * ENHANCEMENT: Updating links to add on documentation and plugin author to PMPro. = .3.2 = * ENHANCEMENT: Wrapped all text to allow translation. = .3.1 = * BUG: Fixed bug where donation dropdown amount was not set correctly when returning from PayPal to review. (Thanks, lok1728 on GitHub) * BUG: Fixed bug where donation amount was not being passed correctly to PayPal. = .3 = * Added support for PayPal express by saving donation amount into a session variable. = .2.2 = * Fixed pricing conflict with PMPro Variable Pricing addon. = .2.1 = * Removed extra </strong> from the order bullets. = .2 = * Fixed the plugin URI * Added the pmpro_donations_get_price_components filter to adjust components (e.g. if you are saving your own itemized prices) = .1 = * This is the initial version of the plugin.
The donation amount is not being stored correctly in member orders. Currently the only way to determine the donation amount is to subtract the subtotal from the total.
Additional Notes:
If the user includes a dollar sign, e.g. '$10' rather than '10', in the donation field the donation is not added to the payment.
Using Version 1.1.1:
In /includes/checkout.php:
line 224 '$level->initial_payment = $level->initial_payment + $donation;' fails if $donation starts with a $ sign.
I added a workaround after line 217:
$donation = ltrim($donation, '$'); // remove any leading $ sign
Steps to Recreate
Environment
Expected Behavior
We should make sure that $settings
is always initialized to an array:
pmpro-donations/includes/common.php
Line 49 in 608303c
Support ticket (admins only): https://www.paidmembershipspro.com/forums/topic/error-message-warning-array_merge-argument-2-is-not-an-array-in-home2/
A user has requested to display donation values separate from subscription values on the account page and invoices instead of the current combined value.
If a membership with the donation option is selected along with any other paid or free membership in the same checkout action the donation option is not displayed (help text and donation field). This is likely caused by a conflict with the Multiple Memberships Per User plugin.
Feature request to include !!donation!! variable for checkout emails.
If you choose "other" you are not setting a maximum donation limit.
The text on the webpage reads donation minimum amount to maximum amount.
If you don't set a maximum amount there is still a $ symbol on the webpage.
I wrote "choose the amount to donate" in the maximum line.
However, the $ symbol was in front of the text and looked odd.
An option may be to remove $ and have individuals write in.
Hi,
When a user enters an initial donation, the amount will carry over to PayPal Express. However, when returning to the confirmation page at the website, the donation box and text appears again and is not populated with the donation amount. If the donation amount is left blank, PayPal will not charge the donation amount. However, the amount is recorded and reflected on the PMPRO order and checkout emails.
Is there any way to skip the additional donation box on the confirmation page, or at least to change the text to read something like "Please confirm your donation amount?"
Thanks!
PMPRO ver. 1.8.4.5
Donation Plugin ver. .2
Wordpress ver. 4.2.3
When returning from PayPal Express, the donation dropdown is disabled (which is correct) but the amount shows 0.00 even if there was a donation submitted. It appears a REQUEST is used instead of SESSION.
LINE 167
<option <?php selected($price, $_REQUEST['donation']);?> value="<?php echo esc_attr($price);?>"><?php echo pmpro_formatPrice((double)$price);?></option
Updating to the below change fixes this issue.
<option <?php selected($price, $_SESSION['donation']);?> value="<?php echo esc_attr($price);?>"><?php echo pmpro_formatPrice((double)$price);?></option>
This is for version .3
If a user chooses a level and place a donation, but then cancels the purchase at the PayPal Express gateway...
When they return to the site and choose a level with not donation, the donation amount is still cached in the total and appears at PayPal checkout.
The donation session variable should clear, right?
We are using a membership level just to accept donations (creates all the same flow as for a membership so works for us). However, on the invoice, it displays Membership Cost: 0. While technically true, appears odd. Would be great to be able to override the bullets function.
I unhooked it in functions.php and then adopted it to our needs but would be great to be able to override it. Thanks
Describe the bug
For the best security and compatibility with things like payment request buttons, the donation field at checkout should be updated to use the pmpro_alter_price css selector (class).
Example here: https://github.com/strangerstudios/paid-memberships-pro/blob/dev/pages/checkout.php#L43
Has this development been abandoned please?
As a pmpro licensed user we would like this functionality. However it is incompatiple when already using the Donation add-on. The comment in the code states "Allow customers to set an additional donation amount " so it is suggesting suitability for our use case.
Hi there - I am unable to save min and max amounts, and if I leave them blank I get the following message during the 'checkout' process:
The highest accepted donation is £. Please enter a new amount.
I am therefore unable to use the donation functionality, as it prevents completion of the registration process unusable.
To confirm I was trying to set the values to 0 and 1000 and did not use any special characters. I also tried with 1 and 1000.
The price dropdown was set to 0,5,10,15,20,other
Thanks in advance for your help, and if you need any additional info, please let me know.
Chris
Add ability to mark a level as a "donation only" level. This level will:
A user reported that in some cases the user's web browsers may autofill the donation input (text) field with parts of an address, e.g. zipcode, street number, etc., saved in the browser resulting in the user being charged for a donation value at checkout.
We could consider adding the HTML attribute autocomplete="off"
for the text input field.
This could not be replicated during testing.
Moderators: # 500040
When a site owner adds a message to the donation "Help Text" field on the Levels page, additional P tags are added on each save.
Example:
The entry my custom message here
will change on each save.
After 3 saves of the level, it would look like this.
<p><p><p>my custom message here</p></p></p>
When you make a LEVEL donation only, and a user checks out, the Checkout-Free template is used. When a checkout is seen as "FREE," certain variables will not populate. The same for the Checkout - Free(admin) email.
Donation Amount: !!donation!!
Invoice total !!invoice-total!!
These, and possibly others, do not populate in the checkout email for a Donation Only Leve, even if you add a custom template.
Ideally, a custom template can be provided for the Donation Only email. But at least, it should not be seen as a "free" level so the needed variables are available.
https://www.paidmembershipspro.com/forums/topic/donation-box-allows-negative-amount/
reports that negative donations are deducted from the membership fee allowing for zero dollar transactions.
I uploaded and activated the Donations Add on.
I set my donation and custom field under my membership but the donations options does not display on the product. Please HELP! URGENT.
In the meantime I created a form using jot form until I solve the issue but I need help as soon as possible.
Thank you in advance for your prompt response.
URL - captainsforcleanwater.org
A user requested that there be a notification sent out to members asking for another donation on a set timeframe. I recommended a level that expires but they do not want to expire users, just remind them on a set interval that they could donate again (the level is free).
Describe the bug
If a user already has a membership level and donates by checking out for a donation-only level their level is changed to the donation-only level if the donation-only level is inside the same level group that only allows a user to have one membership level in that group.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When a user checks out for a donation-only level their original level should not be replaced with the donation-only level.
Isolating the problem (mark completed items with an [x]):
WordPress Environment
Donations are not being stored in order notes.
Tested this with Stripe as payment gateway.
v2.5+ of Paid Memberships Pro introduces the pmpro_membership_ordermeta
table. We should update this Add On to store the user's "donation amount" in the ordermeta.
We would need to check the version of PMPro and make sure that the table is available before completely migrating to this method as the only place the data is stored. We can make the update to save the data in two places (order notes and ordermeta) for perhaps 1 year then update to only store in ordermeta.
This would also resolve issue #25
When price dropdown values is set the checkout page the following error is returned in the debug log `[30-Aug-2019 18:22:06 UTC] PHP Notice: Undefined index: donation_dropdown in /var/sites/public_html/wp/wp-content/plugins/pmpro-donations/pmpro-donations.php on line 182′
Temporary workaround is to check whether donation_dropdown is set.
<?php if(!empty($pmprodon_allow_other) && isset($_REQUEST['donation_dropdown']) && $_REQUEST['donation_dropdown'] != 'other') { ?>
Although the add-on correctly includes donation amounts when using a payment gateway, if processing payments offline, the admin using either "+Add New Order" or "Add member", there is no field to add the donation amount to. Would like to have this functionality added.
May be possible to include it in the Pay-by-Check add-on or include it in the Add New Order/Add Member if the pmpro-donations add-on is included.
An error is being reported by "Site Health" in WordPress when this plugin is activated.
as reported by user: https://www.paidmembershipspro.com/forums/topic/donations-add-on-causing-site-health-issue/
"The REST API request failed due to an error.
Error: cURL error 28: Operation timed out after 10000 milliseconds with 0 bytes received (http_request_failed) "
We were able to replicate in a number of server environments.
Donation-only level with $0 initial payment. Visit the checkout page. Change the donation amount to get the billing fields to show. Enter info and click submit. The form won't communicate with Stripe. The PMPro backend will not get the CC info, including expiration date and will complain about that. Now that the field is loaded with a value, the checkout will work. Also works if a non-zero ?donation param is passed into the URL.
The owner has 0 as the first dropdown option. When the user selects a price, payment fields do not appear until they reload the page.
Related to #23 ?
Is your feature request related to a problem? Please describe.
A customer is trying to use PMPro and Donations together to keep things together and not have to use a separate donation plugin but a lot of the 'donation' workflow is still membership specific such as the confirmation page stating that the 'membership' is active.
Describe the solution you'd like
Ideally we can think out an alternative solution that either references 'donation' instead of membership on the confirmation and emails or separate templates for them.
Describe alternatives you've considered
A custom code solution is possible in the interim
When a customer checks out with a donation, the actual amount charged by PayPal does not include the donation. All other indications, including the price seen on the checkout page, at PayPal checkout, and the confirmation page show the donation amount included.
Steps to re-create:
under the Payment Settings & SSL tab set the Confirmation Step to "Skip the extra confirmation after users return from PayPal Express"
set up a level with donations. Say $100 initial payment.
at checkout choose a donation of $25
checkout through PayPal
after completing checkout, login to the merchant's or customer's PayPal account and check the transaction amount. Instead of being $125 it will only show that $100 was received by the merchant or charged to the customer. All other indications will show $125.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.