Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Sites in a subdirectory produce an error when donating via VFB forms#28

In subdirectory WP installations, VFB forms return an Invalid Form ID error and fail to record the donation in the backend.

User identified this as a URL construction issue for missing a / at the end of the home_url(). Line they’re referring to: [https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|smart-link]

Jon’s suggested solution: Use [https://developer.wordpress.org/reference/functions/trailingslashit/|https://developer.wordpress.org/reference/functions/trailingslashit/|smart-link]

-

Robin Joshua Del Mundo   Apr 9th at 3:05 PM

I managed to test this solution on a test site in a subdirectory installation, and it looks to be a quick solution as we only need to edit one line. So far, I don’t see any kind of ramifications.

Steps to replicate:

  1. Install WordPress and GiveWP on a Subdirectory.
  2. Create a VFB Form.
  3. In a multistep or two panel template, the form will not move after the first step (after the header).
  4. In a classic form template, the donation will not submit.

Changing this line [https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|smart-link] , from home_url()  _to_ rtrim(home_url(), '/').'/'  resolves the issue.

-

Reference

(Migrated from featureOS: https://givewp.featureos.app/p/sites-in-a-subdirectory-produce-an-error-when-donating-via-vfb-forms)

2 years ago
C

Adrian Sylvie via Priority Support

24 days ago
C

Coding Free Support via Priority Support

24 days ago
C

Hieu via Free Support

24 days ago
C

Tarun Patel via Priority Support

24 days ago
C

Anthony Briggs via Priority Support

24 days ago
C

Miami Beach United via Priority Support

24 days ago
C

Gordon Wilson via Priority Support

24 days ago
22 comments hidden
C

Adam Allnutt via Priority Forms

24 days ago
C

krulldna via Free Support

24 days ago
C

johannsf via Free Support

24 days ago
C

David Benner via Priority Support

24 days ago
C

davebenner14 via Free Support

24 days ago
C

انا لاأجد نموذج التبرع الذى انشأته ووضعت موقعى عليه

24 days ago
C

I can’t find the donation form I created and put my site on.

24 days ago
C

dereje2 via Free Support

24 days ago