Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Gravity Perks // Nested Forms // Delay Child Notifications for Parent Payment
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_filter( 'gpnf_should_send_notification', function( $should_send_notification, $notification, $context, $parent_form, $nested_form_field, $entry, $child_form ) {
if( $context == 'parent' ) {
$parent_entry = GFAPI::get_entry( rgar( $entry, 'gpnf_entry_parent' ) );
$should_send_notification = in_array( rgar( $parent_entry, 'payment_status' ), array( 'Paid', 'Active' ) );
}
return $should_send_notification;
}, 10, 7 );
add_action( 'gform_post_payment_completed', function( $entry ) {
if( is_callable( 'gpnf_notification_processing' ) ) {
gpnf_notification_processing()->maybe_send_child_notifications( $entry, GFAPI::get_form( $entry['form_id'] ) );
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.