Description
The gravityflowdiscussion_display_name_discussion_field is used to customize the display name for discussion field values.
Parameters
Parameter | Type | Details |
---|---|---|
$display_name | String | The display name of the current item in the discussion field. |
$item | Array | The current item in the discussion field. |
$step | Step | The field currently being processed. |
Examples
Display the email address for discussion item users.
1 2 3 4 5 6 7 8 9 10 11 | add_filter( 'gravityflowdiscussion_display_name_discussion_field' , 'sh_discussion_display_name' , 10, 3 ); function sh_discussion_display_name( $display_name , $item , $field ) { if ( isset( $item [ 'assignee_key' ] ) ) { $assignee = rgexplode( '|' , $item [ 'assignee_key' ], 2 ); if ( $assignee [0] == 'user_id' ) { $user_data = get_userdata( (int) $assignee [1]); $display_name .= ' (' . $user_data ->user_email . ')' ; } } return $display_name ; } |
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?