Closed allienimmons closed 2 years ago
Watching this, as we can't update the plugin until fixed.
@Benunc You can use this snippet to shorten the subscription plan name for stripe
gateways.
/**
* Filter subscription plan name.
*
* @param string $subscription_name
*
* @return string
*/
function givewp_60514_filtered_recurring_subscription_name( $subscription_name ){
$whiteListGateways = [
'stripe',
'stripe_ach',
'stripe_apple_pay',
'stripe_becs',
'stripe_checkout',
'stripe_google_pay',
'stripe_ideal',
'stripe_sepa'
];
$donorPaymentGateway = give_clean( $_POST['give-gateway'] );
$charLength = 140; // Do not remove it be.
// Shorten subscription plan only for allowed payment gateways.
if(
$charLength > strlen( $subscription_name ) ||
! in_array( $donorPaymentGateway, $whiteListGateways, true )
) {
return $subscription_name;
}
$subscription_name = sprintf(
'%1$s...',
substr( $subscription_name, 0, $charLength - 4 ) // 3 char less to add ' ...'.
);
return $subscription_name;
}
add_filter( 'give_recurring_subscription_name', 'givewp_60514_filtered_recurring_subscription_name' );
Thanks for snippet. So will this not be fixed at an add-on level?
@Jany-M we do plan to incorporate something into either the add-on or GiveWP itself, but as we were evaluating this we determined that you are the only customer currently reporting issues, and a fix within our product will require extensive testing. So I asked Ravinder to make a custom snippet that you can use in the meantime to solve the problem.
If you need assistance implementing custom PHP code on your website we have this guide:
https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/
Please note that this code snippet is provided as an example of how you can extend GiveWP with code. It’s up to you to implement and customize to your liking.
Snippet does work, fatal error is gone. Thank you! This only happened with a recurring donation, not with a single one btw.
@Benunc was this issue ever reported again? it seems like a fairly simple fix for us to include in core to limit the characters of the subscription name.
This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 14 additional days.
Closing in favor of feedback, see https://feedback.givewp.com/bug-reports/p/subscription-payments-fail-when-multi-level-donation-titles-are-longer-than-250.
Bug Report
User Story
As an admin, I want to name my multi-level donation options anything I want, including long strings of text, without the plugin and form failing and preventing the donor from completing the donation.
Current Behavior
Currently, if the multi-level donation title is longer than 250 characters, the plugin will fail.
Expected Behavior
The length of the titles should not affect the ability of the form to take donations successfully.
Bug Type
Steps to Reproduce
Related
https://secure.helpscout.net/conversation/1118260148/60514?folderId=3046394 https://givewp.slack.com/archives/C0E290T6Z/p1585579611007800
Acceptance Criteria
Environment
Operating System
Browser