Description
This filter is used to dynamically alter the tags being created for a Help Scout conversation.
Usage
Applies to all forms:
1 | add_filter( 'gform_helpscout_tags' , 'your_function_name' , 10, 4 ); |
Applies to a specific form:
1 | add_filter( 'gform_helpscout_tags_4' , 'your_function_name' , 10, 4 ); |
Parameters
Parameter | Type | Description |
---|---|---|
$tags | array | An array of tags to be assigned to the conversation. |
$feed | Feed Object | The current feed object. |
$entry | Entry Object | The current entry object. |
$form | Form Object | The current form object. |
Examples
This example retrieves the license type a user has associated to their user meta and adds it as a tag.
1 2 3 4 5 6 7 8 9 10 11 12 | add_filter( 'gform_helpscout_tags' , 'add_license_tag' , 10, 4 ); function add_license_tag( $tags , $feed , $entry , $form ) { global $current_user ; get_currentuserinfo(); $license_type = get_user_meta( $current_user ->ID, 'license_type' , 'No License' ); $tags [] = $license_type ; return $tags ; } |
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?
Source Code
1 | gf_apply_filters( 'gform_helpscout_tags' , $form [ 'id' ], $tags , $feed , $entry , $form ); |
This filter is located in GFHelpScout::process_feed() in class-gf-helpscout.php.