Fcrm_Tokens::fcrm_status_tokens( string $value, array $pieces, int $recipe_id, array $trigger_data, int $user_id, string $replace_args )
Parses the tokens.
Contents
Parameters Parameters
- $value
-
(Required) The value.
- $pieces
-
(Required) The pieces.
- $recipe_id
-
(Required) The recipe id.
- $trigger_data
-
(Required) The trigger data.
- $user_id
-
(Required) The user id.
- $replace_args
-
(Required) The replace args
Return Return
(string) The token value.
Source Source
File: src/integrations/fluent-crm/tokens/fcrm-tokens.php
public function fcrm_status_tokens( $value, $pieces, $recipe_id, $trigger_data, $user_id, $replace_args ) { if ( ! function_exists( '\FluentCrmApi' ) ) { return $value; } if ( ! isset( $pieces[2] ) ) { return $value; } if ( false !== strpos( $pieces[2], 'FLUENTCRM_STATUS_FIELD_' ) ) { $property = str_replace( 'FLUENTCRM_STATUS_FIELD_', '', $pieces[2] ); $contact_api = \FluentCrmApi( 'contacts' ); $contact = $contact_api->getContactByUserId( $user_id ); $token_value = ''; if ( isset( $contact->$property ) ) { $token_value = $contact->$property; } else { // Try custom field. $token_value = $this->get_custom_field_value( $property, $contact->id ); } return $token_value; } return $value; }
Expand full source code Collapse full source code View on Github