gw-cache-buster.php: Fixed an issue where form validation would fail when Cache Buster was enabled globally.
#1136
+4
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2998377368/86389?viewId=8172236
Summary
Issue: When Cache Buster is enabled via the
gfcb_enable_cache_busterfilter, Cache Buster is forced to run on every form render, including the one during the validation request, which causes the issue. Whereas when Cache Buster is enabled via the shortcode attribute, form validation worked correctly since during Gravity Forms' validation request, it re-renders the form without re-evaluating the original shortcode attributes and therefor Cache Buster does not run.Fix: Add a new check for
$_POST['gform_submit']inside theis_cache_busting_applicable()method. This will detect form submissions and disable Cache Buster to ensure Gravity Forms validation process can complete successfully.