Skip to content

Commit c9619d0

Browse files
committed
gw-cache-buster.php: Fixed an issue with Cache Buster and Expired Forms.
1 parent 281b694 commit c9619d0

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

gravity-forms/gw-cache-buster.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,18 @@ public function get_cachebuster_markup( $markup, $atts, $content ) {
262262
// We probably don't need this since everything else should already be loaded by this point but since
263263
// GF is using it as their standard for triggering the `gform_post_render` event, I figured we should follow suit.
264264
gform.initializeOnLoaded( function() {
265-
// Form has been rendered. Trigger post render to initialize scripts.
265+
// Form has been rendered. Trigger post render to initialize scripts if form is not restricted (expired).
266266
<?php
267-
echo sprintf(
268-
'gform.initializeOnLoaded(function() {%s});',
269-
GFFormDisplay::post_render_script(
270-
$form_id,
271-
GFFormDisplay::get_current_page( $form_id )
272-
)
273-
);
267+
$form_restriction_error = rgars( GFFormDisplay::$submission, $form_id . '/form_restriction_error' );
268+
if ( ! $form_restriction_error ) {
269+
echo sprintf(
270+
'gform.initializeOnLoaded(function() {%s});',
271+
GFFormDisplay::post_render_script(
272+
$form_id,
273+
GFFormDisplay::get_current_page( $form_id )
274+
)
275+
);
276+
}
274277
?>
275278
} );
276279
} );

0 commit comments

Comments
 (0)