Filter
uncanny-automator
automator_fluent_crm_token_contact_id
Filters the contact ID token available within FluentCRM automations, allowing for customization of its output.
add_filter( 'automator_fluent_crm_token_contact_id', $callback, 10, 3 );
Description
This filter allows developers to modify the list of enabled triggers that can access the FluentCRM contact ID. It fires when Uncanny Automator is preparing to list available triggers for FluentCRM contacts, enabling customization of which triggers can utilize the contact ID.
Usage
add_filter( 'automator_fluent_crm_token_contact_id', 'your_function_name', 10, 3 );
Parameters
-
$tokens(mixed) - This parameter contains a list of token identifiers that are enabled for contact ID in FluentCRM.
-
$args(mixed) - This parameter contains the tokens that are available for the contact ID when used with FluentCRM.
-
$this(mixed) - This parameter contains additional arguments passed to the filter.
Return Value
The filtered value.
Examples
<?php
/**
* Example function to modify the contact ID tokens available for FluentCRM triggers.
*
* This function demonstrates how to add or remove contact ID-related tokens
* that can be used within Uncanny Automator when integrating with FluentCRM.
*
* @param array $default_tokens The default array of tokens to be enabled.
* @param mixed $original_tokens The original tokens passed to the filter (often unused in this context).
* @param mixed $args Any additional arguments passed to the filter.
* @return array The modified array of enabled contact ID tokens.
*/
function my_automator_fluent_crm_contact_id_tokens( $default_tokens, $original_tokens, $args ) {
// For demonstration purposes, let's assume we want to disable 'ANONFCRMUSERTAG'
// if a specific condition is met. In a real scenario, this condition would be
// based on $args or other global WordPress data.
// Example condition: Only disable if the $args contains a specific key.
// This is a hypothetical example. The actual $args structure would depend on the context.
if ( isset( $args['disable_tag_token'] ) && $args['disable_tag_token'] === true ) {
// Remove 'ANONFCRMUSERTAG' from the list of available tokens.
$default_tokens = array_diff( $default_tokens, array( 'ANONFCRMUSERTAG' ) );
}
// You could also add new tokens if needed, but the hook's purpose seems to be
// controlling which *existing* contact ID tokens are enabled.
// Example: $default_tokens[] = 'MY_CUSTOM_FCRM_CONTACT_TOKEN';
return $default_tokens;
}
// Add the filter to WordPress.
// The priority is 10, and it accepts 3 arguments.
add_filter( 'automator_fluent_crm_token_contact_id', 'my_automator_fluent_crm_contact_id_tokens', 10, 3 );
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/fluent-crm/tokens/fcrm-tokens.php:458
public function get_contact_id_token_enabled_triggers( $tokens, $args ) {
return apply_filters(
'automator_fluent_crm_token_contact_id',
array(
'ANONFCRMUSERLIST',
'ANONFCRMUSERTAG',
),
$tokens,
$args,
$this
);
}
Internal Usage
Found in uncanny-automator-pro/src/integrations/fluent-crm/tokens/fcrm-tokens.php:27:
add_filter( 'automator_fluent_crm_token_contact_id', array( $this, 'token_contact_id_enabled_pro_trigger' ), 10, 3 );