impress-org / givewp-snippet-library

A collection of code snippets to enhance or expand on the free Give WordPress Donation Plugin.
https://givewp.com
140 stars 90 forks source link

fix: prevent field reorder snippet from disabling credit card fields #100

Closed samsmith89 closed 4 years ago

samsmith89 commented 5 years ago

Bug Report

User Story

As a site admin, I want to implement the code snippet I was provided so that I can reorder the fields on my Give forms without the credit card fields becoming disabled.

Current Behavior

Whenever I activate the code snippet, I receive an error on the page and in the console, and the Stripe credit cards elements don't appear on the page.

Expected Behavior

I expect to use the code snippet to reorder fields on the donation form.

Bug Type

Steps to Reproduce

  1. Activate the code snippet on a site
  2. Have Stripe set as the payment gateway
  3. View the page and see the missing fields

Visuals

donboscomissionoffice_local_donations_one-time-donation-form-general-donations-2-2_

Screen Shot 2019-03-27 at 9 38 50 AM

Related

https://secure.helpscout.net/conversation/811939674/36621

Here is the link to the code snippet: https://github.com/impress-org/give-snippet-library/blob/26a7242fd40686b69103c6790c718a24d1c662bf/form-customizations/customize-fieldset-order.php

Acceptance Criteria

Environment

Operating System
  • Platform: Mac OS X
Browser
  • Name: Chrome
WordPress System Info ### WordPress Environment ### Home URL: http://give.local Site URL: http://give.local WP Version: 5.1.1 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US Permalink Structure: /%postname%/ Show on Front: posts Table Prefix Length: wp_ Table Prefix Length: 3 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, acf-disabled, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, give_subscription ### Server Environment ### Hosting Provider: DBH: localhost, SRV: give.local TLS Connection: Connection uses TLS 1.2 TLS Connection: Probably Okay Server Info: Apache/2.4.10 (Debian) PHP Version: 7.1.4 PHP Post Max Size: 1,000 MB PHP Time Limit: 900 PHP Max Input Vars: 3000 PHP Max Upload Size: 1,000 MB cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40. SUHOSIN Installed: – MySQL Version: 5.6.34 Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Give Configuration ### Give Version: 2.4.4 Give Cache: Enabled Database Updates: All DB Updates Completed. Database Tables: ✔ wp_give_donors - 1.0✔ wp_give_donormeta - 1.0✔ wp_give_comments - 1.0✔ wp_give_commentmeta - 1.0✔ wp_give_sessions - 1.0✔ wp_give_logs - 1.0✔ wp_give_logmeta - 1.0✔ wp_give_formmeta - 1.0✔ wp_give_sequential_ordering - 1.0✔ wp_give_donationmeta - 1.0 Give Cache: Enabled Give Cache: ✔New Donation✔Donation Receipt❌New Offline Donation❌Offline Donation Instructions✔New User Registration✔User Registration Information✔Donor Note✔Email access✔Renewal Receipt Email❌Renewal Receipt Email✔Subscription Cancelled Email❌Subscription Cancelled Email❌Subscription Completed Email✔Subscription Reminder Email✔Subscriptions Email Access Upgraded From: 2.4.3 Test Mode: Enabled Currency Code: USD Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: http://give.local/donation-confirmation/ Failure Page: http://give.local/donation-failed/ Donation History Page: http://give.local/donation-history/ Give Forms Slug: /donations/ Enabled Payment Gateways: Stripe - Credit Card, PayPal Standard Default Payment Gateway: Stripe - Credit Card PayPal IPN Verification: Disabled PayPal IPN Notifications: N/A Donor Email Access: Enabled ### Active Give Add-ons ### Give - Annual Receipts: ✔ Licensed – by GiveWP – 1.0.1 Give - Authorize.net Gateway: ✔ Licensed – by GiveWP – 1.4.6 Give - Braintree Gateway: ✔ Licensed – by GiveWP – 1.2.3 Give - CCAvenue Gateway: ✔ Licensed – by GiveWP – 1.0.4 Give - Donation Upsells for WooCommerce: ✔ Licensed – by GiveWP – 1.1.0 Give - Fee Recovery: ✔ Licensed – by GiveWP – 1.7.4 Give - Form Countdown: ❌ Unlicensed – by WordImpress – 1.0.1 Give - Form Field Manager: ✔ Licensed – by GiveWP – 1.4.1 Give - Gift Aid: ✔ Licensed – by GiveWP – 1.2.1 Give - Google Analytics Donation Tracking: ✔ Licensed – by GiveWP – 1.2.1 Give - MailChimp: ✔ Licensed – by GiveWP – 1.4.3 Give - Manual Donations: ✔ Licensed – by GiveWP – 1.4.3 Give - Mollie Gateway: ❌ Unlicensed – by GiveWP – 1.2.1 Give - PayPal Pro Gateway: ✔ Licensed – by GiveWP – 1.2.1 Give - Paytm Gateway: ✔ Licensed – by GiveWP – 1.1.0 Give - PDF Receipts: ✔ Licensed – by GiveWP – 2.3.3 Give - Recurring Donations: ✔ Licensed – by GiveWP – 1.8.10 Give - Square: ❌ Unlicensed – by GiveWP – 1.0.1 Give - Stripe Gateway: ✔ Licensed – by GiveWP – 2.1.6 Give - Tributes: ✔ Licensed – by GiveWP – 1.5.2 Sam's Helper Function: ❌ Unlicensed – by WordImpress – 1.0 ### Other Active Plugins ### Advanced Custom Fields: by Elliot Condon – 5.7.12 All-in-One WP Migration: by ServMask – 6.83 Classic Editor: by WordPress Contributors – 1.4 Give - Hook Helper: by Ravinder Kumar – 1.0 Jetpack by WordPress.com: by Automattic – 7.1.1 Notification: by BracketSpace – 5.3.2 Transients Manager: by Pippin Williamson – 1.7.5 User Role Editor: by Vladimir Garagulya – 4.49 WP Business Reviews: by Impress.org – 1.2.0 ### Inactive Plugins ### Amelia: by TMS – 1.4.4 Give - Email Reports: by WordImpress – 1.1.2 Give - GoCardless Gateway: by WordImpress – 1.2.1 Give - Razorpay: by WordImpress – 1.2.0 WooCommerce: by Automattic – 3.5.5 WordPress Importer: by wordpressdotorg – 0.6.4 ### Active MU Plugins ### Bypass Login: by Stephen Carnam – 1.1.0 ### Theme ### Name: Twenty Seventeen Version: 2.0 Author URL: https://wordpress.org/ Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme
DevinWalker commented 4 years ago

I took care of the warnings for the snippet and added a huge warning because this snippet can cause a lot of issues if you are using multiple gateways or older versions.