Skip to content

Instantly share code, notes, and snippets.

@matty0501
Created June 10, 2024 14:54
Show Gist options
  • Save matty0501/c05290cb7b867b04add1c8f69e8b894e to your computer and use it in GitHub Desktop.
Save matty0501/c05290cb7b867b04add1c8f69e8b894e to your computer and use it in GitHub Desktop.
<?php
/**
* Gravity Perks // Notification Scheduler // Custom Repeat Schedule
* https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/
*/
add_filter( 'gpns_schedule_timestamp', function ( $timestamp, $notification, $entry, $is_recurring, $current_time ) {
// Update "123" to the form ID.
$form_id = 123;
// Update "1a23bc456def7" to the notification ID.
$notification_id = '1a23bc456def7';
// See https://www.php.net/manual/en/datetime.formats.php for supported date/time formats.
if ( ! $is_recurring ) {
return $timestamp;
}
$desired_time = 'today +94 weeks'; // Update to your custom repeat schedule
if ( (int) $entry['form_id'] !== (int) $form_id || $notification['id'] !== $notification_id ) {
return $timestamp;
}
$local_timestamp = gmdate( 'Y-m-d H:i:s', strtotime( $desired_time ) );
$utc_timestamp = strtotime( get_gmt_from_date( $local_timestamp ) );
return $utc_timestamp;
}, 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment