Description
The gravityflow_step_start filter allows customization of the step on which an entry will start its workflow.
Parameters
Parameter | Type | Details |
---|---|---|
$step_id | Integer | The step ID to start the workflow |
$entry_id | Integer | The current entry ID |
$form_id | Integer | The form ID of the current entry |
$status | String | The current step status. |
$step | Step | The starting step. |
Examples
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 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?