Skip to content

Commit 54b9d87

Browse files
authored
Create gpns-only-evaluate-conditional-logic-on-send.php
1 parent cc4fd5a commit 54b9d87

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Notification Scheduler // Only Evaluate Conditional Logic on Send
4+
* https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/
5+
*
6+
* This snippet updates Notification Scheduler evaluate conditional logic when a scheduled notification
7+
* is about to be sent but to ignore conditional when scheduling notifications. This is useful when creating
8+
* scheduled notifications that should be sent if a value has been changed since the original submission.
9+
*/
10+
// Update "123" to your form ID.
11+
add_filter( 'gform_pre_submission_filter_123', function( $form ) {
12+
foreach ( $form['notifications'] as &$notification ) {
13+
if ( rgar( $notification, 'scheduleType', 'immediate' ) !== 'immediate' ) {
14+
$notification['conditionalLogic'] = null;
15+
}
16+
}
17+
return $form;
18+
} );
19+
20+
// Update "123" to your form ID.
21+
add_filter( 'gpns_evaluate_conditional_logic_on_send_123', '__return_true' );

0 commit comments

Comments
 (0)