gform_activecampaign_contact_pre_sync

gform_activecampaign_contact_pre_sync

DescriptionUsageParametersExamplesPlacementSource CodeSince

Description
The gform_activecampaign_contact_pre_sync filter can be used to override the contact properties before the contact_sync request is sent to the API.
Usage
The filter which would run for all ActiveCampaign feeds can be used like so:
add_filter( 'gform_activecampaign_contact_pre_sync', 'your_function_name', 10, 4 );

You can limit the scope of the filter to a single form by appending the form id on the end of the hook name like so:
add_filter( 'gform_activecampaign_contact_pre_sync_5', 'your_function_name', 10, 4 );

Parameters

$contact array
The contact properties. See the ActiveCampaign API documentation for the full list of accepted properties.

$entry Entry Object
The entry currently being processed.

$form Form Object
The form object the current entry was created from.

$feed Feed Object
The feed which is currently being processed.

Examples
This example shows how you can add the ip4 property to the array.
add_filter( 'gform_activecampaign_contact_pre_sync', function( $contact, $entry, $form, $feed ) {

$contact['ip4'] = rgar( $entry, 'ip' );

return $contact;
}, 10, 4 );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$contact = apply_filters( 'gform_activecampaign_contact_pre_sync', $contact, $entry, $form, $feed );
$contact = apply_filters( 'gform_activecampaign_contact_pre_sync_' . $form['id'], $contact, $entry, $form, $feed );

This filter is located in GFActiveCampaign::process_feed() in class-gf-activecampaign.php.
Since
This filter was added in ActiveCampaign 1.3.5.

發表回覆

您的電子郵箱地址不會被公開。 必填項已用 * 標註