Filter
uncanny-automator
automator_drip_default_subscriber_fields
Filters the default subscriber fields available for Drip integrations to customize available data points.
add_filter( 'automator_drip_default_subscriber_fields', $callback, 10, 1 );
Description
Filters the default array of Drip subscriber fields, mapping user-friendly labels to Drip API identifiers. Developers can modify this array to customize the available fields for Drip subscriber actions.
Usage
add_filter( 'automator_drip_default_subscriber_fields', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example of how to add a custom field to the default Drip subscriber fields.
*
* This function will add a new field 'Account Type' which maps to a custom
* field in Drip. This is useful if you want to segment your subscribers
* based on account types defined in your WordPress site.
*
* @param array $default_fields The default Drip subscriber fields.
* @return array The modified Drip subscriber fields with the new custom field.
*/
add_filter(
'automator_drip_default_subscriber_fields',
function ( $default_fields ) {
// Add a new custom field for 'Account Type'
$default_fields['Account Type'] = 'account_type';
// You could also potentially modify existing fields or remove them if needed.
// For example, to remove 'Phone':
// unset( $default_fields['Phone'] );
return $default_fields;
},
10, // Priority: 10 is the default priority
1 // Accepted args: Only accepting the first parameter ($default_fields)
);
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/drip/actions/drip-create-subscriber.php:128
public static function default_fields() {
return apply_filters(
'automator_drip_default_subscriber_fields',
array(
'First name' => 'first_name',
'Last name' => 'last_name',
'Address line 1' => 'address1',
'Address line 2' => 'address2',
'City' => 'city',
'State' => 'state',
'Zip' => 'zip',
'Country' => 'country',
'Phone' => 'phone',
'SMS number' => 'sms_number',
'SMS consent (boolean)' => 'sms_consent',
'Custom user ID' => 'user_id',
'Time zone (in Olson format)' => 'time_zone',
'Lifetime value (in cents)' => 'lifetime_value',
'IP address (E.g. "111.111.111.11")' => 'ip_address',
'Add tags (comma separated)' => 'tags',
'Remove tags (comma separated)' => 'remove_tags',
'Prospect (boolean)' => 'prospect',
'Base lead score (integer)' => 'base_lead_score',
'EU consent ("granted" or "denied")' => 'eu_consent',
'EU consent message' => 'eu_consent_message',
'Status (either "active" or "unsubscribed")' => 'status',
'Initial status (either "active" or "unsubscribed")' => 'initial_status',
)
);
}