diff --git a/gravity-forms/gw-cache-buster.php b/gravity-forms/gw-cache-buster.php index 44141045..b1aa30bb 100644 --- a/gravity-forms/gw-cache-buster.php +++ b/gravity-forms/gw-cache-buster.php @@ -39,7 +39,6 @@ public function init() { return; } - add_filter( 'gform_pre_render', array( $this, 'clear_gpnf_cookies' ) ); add_filter( 'gform_shortcode_form', array( $this, 'shortcode' ), 10, 3 ); add_filter( 'gform_save_and_continue_resume_url', array( $this, 'filter_resume_link' ), 15, 4 ); add_filter( 'gform_pre_replace_merge_tags', array( $this, 'replace_embed_url' ), 10, 4 ); @@ -49,22 +48,6 @@ public function init() { add_action( 'wp_ajax_gfcb_get_form', array( $this, 'ajax_get_form' ) ); } - public function clear_gpnf_cookies( $form ) { - - if ( class_exists( 'GPNF_Session' ) && $this->is_cache_busting_applicable() ) { - $session = new GPNF_Session( $form['id'] ); - $cookie_name = $session->get_cookie_name(); - foreach ( $_COOKIE as $name => $value ) { - if ( preg_match( '/^' . preg_quote( $cookie_name, '/' ) . '/', $name ) ) { - unset( $_COOKIE[ $name ] ); - setcookie( $name, '', time() - ( 15 * 60 ), COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); - } - } - } - - return $form; - } - public function shortcode( $markup, $attributes, $content ) { $atts = shortcode_atts( @@ -162,8 +145,11 @@ public function shortcode( $markup, $attributes, $content ) { // Still needed for the AJAX submission. $ajax_url = add_query_arg( array( - 'action' => 'gfcb_get_form', - 'form_id' => $form_id, + 'action' => 'gfcb_get_form', + 'form_id' => $form_id, + 'gpnf_context' => array( + 'path' => class_exists( 'GPNF_Session' ) ? esc_js( GPNF_Session::get_session_path() ) : '', + ), ), $ajax_url );