Description
The gravityflow_step_start filter allows custom logic to perform when any step starts.
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
Change the entry creator after an entry has been created by a New Entry workflow step
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?