gform_agilecrm_tags

Description

This filter is used to dynamically alter the tags to be assigned to a contact in Agile CRM.

Usage

The following would apply to all feeds:

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

To target feeds for a specific form append the form id to the hook name. (format: gform_agilecrm_tags_FORMID)

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

Parameters

  • $tags array

    An array of tags to be assigned to the contact.

  • $feed Feed Object

    The feed currently being processed.

  • $entry Entry Object

    The entry currently being processed.

  • $form Form Object

    The form currently being processed.

Examples

1. Always add tags

This example shows how you can add a new tag.

add_filter( 'gform_agilecrm_tags', 'add_new_tag', 10, 4 );
function add_new_tag( $tags, $feed, $entry, $form ) {
$tags[] = 'some tag';

return $tags;
}

2. Add tag depending on field value

This example shows how you can add a tag depending on an entry field value.

add_filter( 'gform_agilecrm_tags', 'add_new_tag', 10, 4 );
function add_new_tag( $tags, $feed, $entry, $form ) {
$product = rgar( $entry, '15' );

if ( $product != 'gravityforms' ) {
$tags[] = 'some tag';
}

return $tags;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

gf_apply_filters( 'gform_agilecrm_tags', $form['id'], $tags, $feed, $entry, $form );

This filter is located in the following methods in class-gf-agilecrm.php:

  • GFAgileCRM::create_contact()
  • GFAgileCRM::update_contact()