Form on ‘Latest posts’ page bug + fix
-
Hi,
Thanks for this great plugin!
My client wanted the donate form on the homepage, which is set to ‘Your latest posts’ in de Reading settings. I’ve added the shortcode in the index.php file.
The problem was that the success/failure redirects were not working, I’ve set those to specific pages. It was redirecting to the latest blog post instead, for both success and failure.
Here is how I fixed it (which is a request for an update to the plugin).
File: includes/class-start.php
Before this line:
$payment = $mollie->payments->create(array(
I’ve added this:if(is_home()) $redirectBaseUrl = home_url() . '/'; else $redirectBaseUrl = get_page_link();
And I’ve changed this:
"redirectUrl" => get_page_link() . '?dmm_id=' . $donation_id,
To this:
"redirectUrl" => $redirectBaseUrl . '?dmm_id=' . $donation_id,
The only thing I’m not sure of, is the is_home() function, not sure how solid it is in recognizing the homepage/blogpage, but maybe you know more about that. In my case it worked at least.
Kind Regards,
Sybren DijkstraPS: you got a nice last name ??
- The topic ‘Form on ‘Latest posts’ page bug + fix’ is closed to new replies.