Description
The gravityflow_send_to_step_condition_not_met filter determines what next step a workflow should proceed to instead of the selected step that failed its step conditions.
Note: This filter only executes if gravityflow_send_to_step_condition_met_required is also filtered to return true for the current potential step change.
Parameters
Parameter | Type | Details |
---|---|---|
$next_step | Step | The next step to send the entry to. Defaults to the next step after the proposed new step that meets its’ start conditions. |
$new_step | Step | The proposed new step that failed its step conditions. |
$current_step | Step | The current step. |
Examples
Identify a specific step to send to when condition is not met
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | add_filter( 'gravityflow_send_to_step_condition_not_met' , 'jo_what_step_next' , 10, 5 ); function jo_what_step_next( $next_step , $new_step , $current_step , $entry , $form ) { if ( $new_step ->get_id() == '296' ) { $api = new Gravity_Flow_API( $form [ 'id' ] ); $steps = $api ->get_steps(); foreach ( $steps as $potential_step ) { if ( $potential_step ->get_id() == '297' ) { error_log ( 'Re-routing to 297' ); $new_step = $potential_step ; break ; } } } return $next_step ; } |
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?