gravityflow_step_due_date_timestamp
The gravityflow_step_due_date_timestamp filter allows the due_date timestamp to be overridden.
Parameters
Parameter | Type | Definition |
---|---|---|
$due_date_timestamp | integer | The current scheduled due date (UTC). |
$expiration_type | string | The type of expiration defined in step settings. |
$step | Gravity_Flow_Step | The current step. |
Examples
Example 1 - Adjust due date based on a field value
This example increases the due date by a day for a specific form with a specific value on one of the entries.
add_filter( 'gravityflow_step_due_date_timestamp', 'extend_expiration_date', 10, 3 ); function extend_expiration_date( $due_date_timestamp, $expiration_type, $step ) { //Ensure you are only adjusting the desired form/step if ( $step->get_id() !== 76 ) { return $due_date_timestamp; } $entry = $step->get_entry(); if ( $entry && isset( $entry['2'] ) && $entry['2'] == 'Extended' ) { $due_date_timestamp = strtotime('+1 day', $due_date_timestamp ); } return $due_date_timestamp; }
Placement
This code should be placed in the functions.php file of your active theme or in a custom functions plugin.