gform_helpscout_tags

Description

This filter is used to dynamically alter the tags being created for a Help Scout conversation.

Usage

Applies to all forms:

add_filter( 'gform_helpscout_tags', 'your_function_name', 10, 4 );

Applies to a specific form:

add_filter( 'gform_helpscout_tags_4', 'your_function_name', 10, 4 );

Parameters

  • $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.

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 should be placed in the functions.php file of your active theme.

Source Code

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.