-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gspc-trigger-wp-fusion-feed.php
: Added new snippet to improve GSPC …
…compatibility with WP Fusion.
- Loading branch information
1 parent
3fefeb2
commit b9fca3b
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Gravity Shop // GS Product Configurator // Trigger WP Fusion feed when payment is delayed | ||
* | ||
* WP Fusion does not register its Gravity Forms add-on using `GFAddOn::register`, nor does it | ||
* run `add_delayed_payment_support` which means the feed won't run when the payment is delayed. | ||
* | ||
* This snippet works around that. | ||
*/ | ||
add_action('plugins_loaded', function() { | ||
if ( function_exists( 'wp_fusion' ) ) { | ||
add_action( 'gform_trigger_payment_delayed_feeds', function ( $transaction_id, $payment_feed, $entry, $form ) { | ||
if ( ! property_exists( wp_fusion(), 'integrations' ) || ! property_exists( wp_fusion()->integrations, 'gravity-forms' ) ) { | ||
return; | ||
} | ||
|
||
$addon = wp_fusion()->integrations->{'gravity-forms'}; | ||
|
||
add_filter( 'gspc_delay_feed_processing', '__return_false', 9998 ); | ||
$addon->maybe_process_feed( $entry, $form ); | ||
remove_filter( 'gspc_delay_feed_processing', '__return_false', 9998 ); | ||
}, 10, 4 ); | ||
} | ||
}); |