Skip to content

Instantly share code, notes, and snippets.

@spivurno
Created January 17, 2020 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/47c700543e04b32229ca1b3d14d4ae4b to your computer and use it in GitHub Desktop.
Save spivurno/47c700543e04b32229ca1b3d14d4ae4b to your computer and use it in GitHub Desktop.
Modified WC_GFPA_Cart::enable_gform_after_submission_hooks() method.
private function disable_gform_after_submission_hooks( $form_id ) {
global $wp_filter, $wp_actions;
$tag = 'gform_after_submission';
if ( ! isset( $this->_wp_filters[ $tag ] ) ) {
if ( isset( $wp_filter[ $tag ] ) ) {
$this->_wp_filters[ $tag ] = $wp_filter[ $tag ];
unset( $wp_filter[ $tag ] );
}
}
$tag = "gform_after_submission_{$form_id}";
if ( ! isset( $this->_wp_filters[ $tag ] ) ) {
if ( isset( $wp_filter[ $tag ] ) ) {
$this->_wp_filters[ $tag ] = $wp_filter[ $tag ];
unset( $wp_filter[ $tag ] );
}
}
$tag = 'gform_entry_post_save';
if ( ! isset( $this->_wp_filters[ $tag ] ) ) {
if ( isset( $wp_filter[ $tag ] ) ) {
$this->_wp_filters[ $tag ] = $wp_filter[ $tag ];
unset( $wp_filter[ $tag ] );
}
}
$tag = "gform_entry_post_save_{$form_id}";
if ( ! isset( $this->_wp_filters[ $tag ] ) ) {
if ( isset( $wp_filter[ $tag ] ) ) {
$this->_wp_filters[ $tag ] = $wp_filter[ $tag ];
unset( $wp_filter[ $tag ] );
}
}
}
private function enable_gform_after_submission_hooks( $form_id ) {
global $wp_filter;
$tag = 'gform_after_submission';
if ( isset( $this->_wp_filters[ $tag ] ) ) {
$wp_filter[ $tag ] = $this->_wp_filters[ $tag ];
}
$tag = "gform_after_submission_{$form_id}";
if ( isset( $this->_wp_filters[ $tag ] ) ) {
$wp_filter[ $tag ] = $this->_wp_filters[ $tag ];
}
$tag = 'gform_entry_post_save';
if ( isset( $this->_wp_filters[ $tag ] ) ) {
$wp_filter[ $tag ] = $this->_wp_filters[ $tag ];
}
$tag = "gform_entry_post_save_{$form_id}";
if ( isset( $this->_wp_filters[ $tag ] ) ) {
$wp_filter[ $tag ] = $this->_wp_filters[ $tag ];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment