Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gw-cache-buster.php: Fixed an issue with Cache Buster and Expired Forms. #1007

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions gravity-forms/gw-cache-buster.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,18 @@ public function get_cachebuster_markup( $markup, $atts, $content ) {
// We probably don't need this since everything else should already be loaded by this point but since
// GF is using it as their standard for triggering the `gform_post_render` event, I figured we should follow suit.
gform.initializeOnLoaded( function() {
// Form has been rendered. Trigger post render to initialize scripts.
// Form has been rendered. Trigger post render to initialize scripts if form is not restricted (expired).
<?php
echo sprintf(
'gform.initializeOnLoaded(function() {%s});',
GFFormDisplay::post_render_script(
$form_id,
GFFormDisplay::get_current_page( $form_id )
)
);
$form_restriction_error = rgars( GFFormDisplay::$submission, $form_id . '/form_restriction_error' );
if ( ! $form_restriction_error ) {
echo sprintf(
'gform.initializeOnLoaded(function() {%s});',
GFFormDisplay::post_render_script(
$form_id,
GFFormDisplay::get_current_page( $form_id )
)
);
}
?>
} );
} );
Expand Down
Loading