Only Evaluate Conditional Logic on Send

This snippet updates Notification Scheduler evaluate conditional logic when a scheduled notification is about to be sent but to ignore conditional when scheduling notifications. This is useful when creating scheduled notifications that should be sent if a value has been changed since the original submission.

Code

Filename: gpns-only-evaluate-conditional-logic-on-send.php

<?php
/**
 * Gravity Perks // Notification Scheduler // Only Evaluate Conditional Logic on Send
 * https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/
 *
 * This snippet updates Notification Scheduler evaluate conditional logic when a scheduled notification
 * is about to be sent but to ignore conditional when scheduling notifications. This is useful when creating
 * scheduled notifications that should be sent if a value has been changed since the original submission.
 */
// Update "123" to your form ID.
add_filter( 'gform_pre_submission_filter_123', function( $form ) {
	foreach ( $form['notifications'] as &$notification ) {
		if ( rgar( $notification, 'scheduleType', 'immediate' ) !== 'immediate' ) {
			$notification['conditionalLogic'] = null;
		}
	}
	return $form;
} );

// Update "123" to your form ID.
add_filter( 'gpns_evaluate_conditional_logic_on_send_123', '__return_true' );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.