Givewp: Form templates should not require pretty permalinks

Created on 24 Jul 2020  Â·  4Comments  Â·  Source: impress-org/givewp

User Story

As a site administrator, I want to publish a donation form with my existing permalinks structure.

Details

The default permalink structure causes a 404 in the form template iframe, which results in a persistent loading animation.

Expected Behavior

The form template iframe should load regardless of the site's permalinks configuration.

Steps to Reproduce

  1. Set permalinks to "Plain" (?p=123)
  2. Create a new donation form
  3. Set the form template to "Multi-Step Donation Form"
  4. Click "View Form"
  5. The form does not display

Visuals

| Permalinks | Form Template |
| --- | --- |
| image | image |
|image | image |

Additional Context

System Information

Details

WordPress Environment

Home URL: https://wordpress.test
Site URL: https://wordpress.test
WP Version: 5.4.2
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: âś”
Language: en_US
Permalink Structure:
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, refunded, failed, revoked, cancelled, abandoned, processing, preapproval

Server Environment

Hosting Provider: DBH: localhost, SRV: wordpress.test
TLS Connection: Connection uses TLS 1.3
TLS Connection: Probably Okay
Server Info: Apache/2.4.41 (Ubuntu)
PHP Version: 7.4.3
PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
PHP Max Upload Size: 2 MB
cURL Version: 7.68.0, OpenSSL/1.1.1f
SUHOSIN Installed: –
MySQL Version: 8.0.20
Default Timezone is UTC: âś”
fsockopen/cURL: âś”
SoapClient: ❌ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected.
DOMDocument: âś”
gzip: âś”
GD Graphics Library: âś”
Multibyte String: âś”
Remote Post: âś”
Remote Get: âś”

GiveWP Configuration

GiveWP Version: 2.7.2
GiveWP 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
GiveWP Cache: Enabled
GiveWP Cache: ✔New Donation✔Donation Receipt✔New Offline Donation✔Offline Donation Instructions✔New User Registration✔User Registration Information✔Donation Note✔Email access
Upgraded From: –
Test Mode: Enabled
Currency Code: USD
Currency Position: Before
Decimal Separator: .
Thousands Separator: ,
Success Page: https://wordpress.test/?page_id=5
Failure Page: https://wordpress.test/?page_id=6
Donation History Page: https://wordpress.test/?page_id=7
GiveWP Forms Slug: /donations/
Enabled Payment Gateways: Test Donation, Offline Donation, Stripe - Credit Card
Default Payment Gateway: Test Donation
PayPal IPN Verification: Enabled
PayPal IPN Notifications: N/A
Donor Email Access: Enabled
Stripe Webhook Notifications: N/A

Active GiveWP Add-ons

Other Active Plugins

Inactive Plugins

Classic Editor: by WordPress Contributors – 1.5
Give - Fee Recovery: by GiveWP – 1.7.11
Give - Form Field Manager: by GiveWP – 1.4.7
LifterLMS: by LifterLMS – 4.2.0
Ninja Shop: by Ninja Shop LLC – 1.1.11
Ninja Shop - Membership: by Ninja Shop LLC – 1.0.2
Ninja Shop - Recurring Payments: by Ninja Shop LLC – 2.0.2
Organized Search Results: by –
Query Monitor: by John Blackbourn – 3.6.0
Video Library: by –
WooCommerce: by Automattic – 4.3.1
WooCommerce Order Shipping Export: by Forge Media – 2020.06.23-12.53
WooCommerce Order Taxes Export: by Forge Media – 2020.06.17-12.55
WooCommerce Subscription Retention Summary: by Forge Media – 2020.06.23-12.53
WooCommerce Subscriptions: by WooCommerce – 3.0.1
WordPress Importer: by wordpressdotorg – 0.7
Yarnell Authorize.NET ARB (Automatice Recurring Billing): by –

Active MU Plugins

git-branch-names.php: by –
load.php: by –

Theme

Name: Twenty Twenty
Version: 1.2
Author URL: https://wordpress.org/
Child Theme: No – If you're modifying GiveWP on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme

Acceptance Criteria

  • [x] Form Template Loads with "Plain" permalinks
  • [x] Form Template Loads with"Post Name" permalinks
  • [x] Form Template Loads with "Custom Structure" permalinks
bug

Most helpful comment

I agree with @JasonTheAdams. Embed from iframe URL is for internal use and instead of setting a custom rewrite URL, we can take leverage of index.php with custom query parameter which will work on most cases.

All 4 comments

This issue has been linked to a Canny post: Plain permalinks should not break multi-step form template :tada:

WordPress basically provides three options for API's:

  1. WordPress REST API
  2. Use index.php with a query string
  3. As admin-ajax.php

It we're intending to provide a public resource, we should use #1.

If it's in the admin-side, we should use #3.

If it's front-end but intended for internal GiveWP use (i.e. not a public resource), then #2 is a solid option. Also, this is the only scenario wherein rewrites (i.e. permalinks) actually matter. Rewrites just take a regex and bind it to some index.php?query_var=something endpoint. To avoid issues with permalinks, the simplest scenario is to just forego the rewrite altogether and just use index.php directly.

I agree with @JasonTheAdams. Embed from iframe URL is for internal use and instead of setting a custom rewrite URL, we can take leverage of index.php with custom query parameter which will work on most cases.

I'll second foregoing the URL rewrite. In this case, the form is embeded in an iframe, so the pretty permalinks aren't required.

Additionally, it is important for features to work regardless of the permalink structure, which as Jason points out rewrites to query strings anyway.

Was this page helpful?
0 / 5 - 0 ratings