Skip to content

Instantly share code, notes, and snippets.

@rvdsteege
Last active December 20, 2023 09:11
Show Gist options
  • Save rvdsteege/6b0afe10f81b1bc99d335ff484206fa9 to your computer and use it in GitHub Desktop.
Save rvdsteege/6b0afe10f81b1bc99d335ff484206fa9 to your computer and use it in GitHub Desktop.
Gravity Perks Unique ID _wait for payment_ support for Pronamic Pay.
/**
* 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 );
@remcotolsma
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment