gravityflow_timeline_note_add
The gravityflow_timeline_note_add filter allows customization of the timeline note before it is added to the database.
Parameters
Parameter | Type | Definition |
---|---|---|
$note | String | The message to be added to the timeline. |
$entry_id | integer | The current entry id. |
$user_id | boolean|integer | The ID of user performing the action or false (if system generated). |
$user_name | string | The username performing the action. |
$step | bool|Gravity_Flow_Step | If it is a step based action the current step. |
Examples
Example 1 - Add the Step ID to the timeline message for any step-based updates.
add_filter( 'gravityflow_timeline_note_add', 'jo_timeline_note_customize', 10, 5 ); function jo_timeline_note_customize( $note, $entry_id, $user_id, $user_name, $step ) { if ( $step ) { $note = 'Step ID #' . $step->get_id() . ' - ' . $note; } return $note;}
Example 2 - Add the Updated User Email on a User Update Workflow Step
add_filter( 'gravityflow_timeline_note_add', 'user_input_audit', 10, 5 ); function user_input_audit( $note, $entry_id, $user_id, $user_name, $step ) { // for a specific step id corresponding to your user input step if ( $step->get_id() == 552 ) { $entry = $step->get_entry(); $updated_email = $entry['4']; // field ID 4 on the form corresponds to email used for updated $note = $note . ' The updated email is ' . $updated_email . '.'; } return $note; }
Placement
This code should be placed in the functions.php file of your active theme or in a custom functions plugin.