gravityflow_step_start

Description

The gravityflow_step_start filter allows customization of the step on which an entry will start its workflow.

Parameters

ParameterTypeDetails
$step_idIntegerThe step ID to start the workflow
$entry_idIntegerThe current entry ID
$form_idIntegerThe form ID of the current entry
$statusStringThe current step status.
$stepStepThe starting step.

Examples

Start a workflow on a random step for a particular form

1
2
3
4
5
6
7
8
9
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 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?