Overview
The gform_constantcontact_subscriber_details filter allows developers to modify the subscriber details before sending them to Constant Contact.
Usage
add_filter( 'gform_constantcontact_subscriber_details', 'your_function_name', 10, 5 );
Parameters
| Parameter | Type | Description |
|---|---|---|
| $subscriber_details | array | The subscriber details being sent to Constant Contact. |
| $feed | array | The feed configuration currently being processed. |
| $entry | array | The entry currently being processed. |
| $form | array | The form currently being processed. |
| $contact | array | The existing contact details from Constant Contact, or an empty array if this is a new contact. |
Examples
Add Custom Fields to Subscriber.
This example demonstrates how to add custom field data to the subscriber details before sending to Constant Contact.
add_filter( 'gform_constantcontact_subscriber_details', function( $subscriber_details, $feed, $entry, $form, $contact ) {
// Add a custom field value
$subscriber_details['custom_fields'][] = array(
'custom_field_id' => 'your_custom_field_id',
'value' => rgar( $entry, '5' ) // Get value from form field 5
);
return $subscriber_details;
}, 10, 5 );
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
This filter is located in GF_ConstantContact::subscribe_to_list() in class-gf-constantcontact.php.
Since
This filter was added in Constanct Contact Add-On 1.8.1