Skip to content

Commit

Permalink
gpnf-delay-child-notifications-for-parent-payment.php: Updated beha…
Browse files Browse the repository at this point in the history
…vior to send notifications if the parent entry does not have a payment status. This provides more flexibility with conditional logic.
  • Loading branch information
malayladu authored Jan 8, 2025
1 parent cb6ab45 commit 353aeb7
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin URI: http://gravitywiz.com/documentation/gravity-forms-nested-forms/
* Description: Delay GP Nested Forms child form notification until payment processing is completed.
* Author: Gravity Wiz
* Version: 1.1
* Version: 1.1.1
* Author URI: http://gravitywiz.com
*/
class GW_GPNF_Delay_Child_Notifications {
Expand Down Expand Up @@ -43,12 +43,13 @@ public function init() {

public function gpnf_should_send_notification( $should_send_notification, $notification, $context, $parent_form, $nested_form_field, $entry, $child_form ) {
if ( $context === 'parent' && $this->is_applicable_form( $parent_form['id'] ) ) {
$parent_entry = GFAPI::get_entry( rgar( $entry, 'gpnf_entry_parent' ) );
$should_send_notification = in_array( rgar( $parent_entry, 'payment_status' ), array( 'Paid', 'Active' ), true );
$parent_entry = GFAPI::get_entry( rgar( $entry, 'gpnf_entry_parent' ) );
$payment_status = rgar( $parent_entry, 'payment_status', '' );

$should_send_notification = in_array( $payment_status, array( '', 'Paid', 'Active' ), true );
}

return $should_send_notification;

}

public function gform_post_payment_completed( $entry ) {
Expand Down

0 comments on commit 353aeb7

Please sign in to comment.