paid-memberships-pro icon indicating copy to clipboard operation
paid-memberships-pro copied to clipboard

Fix for re-captcha function not defined (yet)

Open mircobabini opened this issue 2 years ago • 1 comments

All Submissions:

Changes proposed in this Pull Request:

We have seen that having the recaptcha function loaded conditionally can cause issues as reported in #2058 which is just a POC to be able to replicate the issue in an easy way. Moving the function to the functions.php is an easy fix with no headaches, because the function has a prefix, it's safe to be always declared. Still pluggable though.

How to test the changes in this Pull Request:

  1. Install pmpro latest, deactivate recaptcha, install the snippet in #2058 and open the checkout page. Broken.

Other information:

  • [x] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [x] Have you successfully run tests with your changes locally?

mircobabini avatar May 24 '22 08:05 mircobabini

In the current dev branch, if you have reCAPCHA set up and go to a checkout shortcode page that is NOT set as a checkout page, it will immediately fatal error.

When I tested with this PR PR, it lets you fill out the checkout page and does not show reCAPTCHA, but then fatal errors after the form is submitted with error Fatal error: Uncaught Error: Class "pmpro_ReCaptcha" not found in /..../paid-memberships-pro/preheaders/checkout.php on line 415.

So either way, it seems like reCAPTCHA does not work at checkout if not set as the checkout page. Not sure if this is something that we want to fix

dparker1005 avatar Jun 08 '22 19:06 dparker1005

Closing in favor of #2112 which was released in PMPro v2.11. If any issues still exist with that new version, we can continue looking into this.

dparker1005 avatar Jul 12 '23 17:07 dparker1005