Last active
December 20, 2023 09:11
Gravity Perks Unique ID _wait for payment_ support for Pronamic Pay.
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
/** | |
* Gravity Perks Unique ID wait for payment support for Pronamic Pay. | |
* http://gravitywiz.com/documentation/gp-unique-id/ | |
*/ | |
add_filter( 'gpui_wait_for_payment', function( $enabled ) { | |
if ( class_exists( '\Pronamic\WordPress\Pay\Extensions\GravityForms\Extension' ) ) { | |
$enabled = true; | |
} | |
return $enabled; | |
} ); | |
add_filter( 'gpui_wait_for_payment_feed', function( $feed, $form, $entry ) { | |
if ( class_exists( '\Pronamic\WordPress\Pay\Extensions\GravityForms\FeedsDB' ) ) { | |
$feed = \Pronamic\WordPress\Pay\Extensions\GravityForms\FeedsDB::get_feed_by_entry_id( $entry['id'] ); | |
if ( null === $feed ) { | |
$feeds = \Pronamic\WordPress\Pay\Extensions\GravityForms\FeedsDB::get_active_feeds_by_form_id( $entry['form_id'] ); | |
$feed = array_shift( $feeds ); | |
} | |
} | |
return $feed; | |
}, 10, 3 ); | |
add_action( 'gform_ideal_fulfillment', function( $entry ) { | |
$form = GFAPI::get_form( $entry['form_id'] ); | |
gp_unique_id_field()->populate_field_value( $entry, $form, true ); | |
}, 9 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because support for the "GP Unique ID" plugin (perk) in combination with the "Pronamic Pay" plugin has been requested a number of times, we have created an issue for this: pronamic/wp-pronamic-pay-gravityforms#38. Anyone who is interested in this can always report this in this issue and follow any developments.