gravityflow_send_to_step_condition_not_met

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 Definition
$next_step Gravity_Flow_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 Gravity_Flow_Step The proposed new step that failed its step conditions.
$current_step Gravity_Flow_Step The current step.
$entry Array The current entry array.
$form Array The current form.

Examples

Example 1 - Identify a specific step to send to when condition is not met.

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 should be placed in the functions.php file of your active theme or in a custom functions plugin.