gravityflow_assignee_choices
The filter gravityflow_assignee_choices allows the assignee choices to be modified
Parameters
Parameter | Type | Definition |
---|---|---|
$choices | Array | The assignee choices. |
$form | Form | The Form. |
Examples
Example 1 - Populate user email in step settings
Populate User email instead of User name in step settings.
add_filter( 'gravityflow_assignee_choices', 'display_user_emails', 10, 2 ); function display_user_emails( $choices, $form ) { // Loop over "User" choices foreach( $choices[0]['choices'] as &$choice ) { // get user id $user_id = explode ( '|', $choice['value'] )[1] ; // get the user $user = get_user_by( 'id', $user_id ); // update label to display email in place of the username $choice['label'] = $user->user_email; } return $choices; }
Placement
This code should be placed in the functions.php file of your active theme or in a custom functions plugin.