Created
March 22, 2019 02:41
-
-
Save spivurno/f17b19b09425308b684e19ea6b77599a to your computer and use it in GitHub Desktop.
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
<?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
Can this work if the gravity form is being used with Woocommerce?