Description
The gravityflow_step_due_date_timestamp filter allows the due_date timestamp to be overridden.
Parameters
Parameter | Type | Details |
---|---|---|
$due_date_timestamp | Integer | The current scheduled due date (UTC) |
$expiration_type | String | The type of expiration defined in step settings. |
$t | Step | The current step. |
Examples
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 can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?