gravityflow_step_start

Description

The gravityflow_step_start filter allows custom logic to perform when any step starts.

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

Change the entry creator after an entry has been created by a New Entry workflow step

1
2
3
4
5
6
7
8
9
10
add_action( 'gravityflow_step_start', 'sb_gravityflow_step_start', 10, 5 );
function sb_gravityflow_step_start( $step_id, $entry_id, $form_id, $status, $step ) {
     //Change step ID to match your scenario
     if ( $step && $step_id == 335 ) {
         $entry = GFAPI::get_entry( $entry_id );
         $user = get_user_by( 'email',  rgar($entry, '1']  ); // 1 is the ID of the field with user email
         GFAPI::update_entry_property( $entry['id'], 'created_by', $user->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?