gravityflow_step_start

The gravityflow_step_start filter allows customization of what step an entry will start its' workflow on.

Parameters

Parameter Type Definition
$step_id int The step ID to start the workflow
$entry_id int The current entry ID
$form_id int The form ID of the current entry
$status string The current entry array.
$step Gravity_Flow_Step
The starting step.

Examples

Example 1 - Start a workflow on a random step for a particular form

add_action( 'gravityflow_step_start', 'jo_start_random', 10, 5 );
function jo_start_random( $step_id, $entry_id, $form_id, $status, $step ) {
     //Change the form ID and potential step IDs to match your scenario
     if ( $form_id == '7' ) {
          $potential_steps = array( '12', '14', '17', '32' );
          return $potential_steps[array_rand($potential_steps)];
     }
     return $step_id;
}

Placement

This code should be placed in the functions.php file of your active theme or in a custom functions plugin.