Description
The gravityflow_timeline_note_add filter allows customization of the timeline note before it is added to the database.
Parameters
Parameter | Type | Details |
---|---|---|
$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 | Step | If it is a step based action the current step. |
Examples
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;}
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 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?