# Global Functions

FluentCRM has few global functions which are located at app/functions/helpers.php file. In this article, we are documenting few useful functions that you may use. For full understanding, please check the app/functions/helpers.php file

# fluentcrm_get_option

Get FluentCRM Option. This is similar to WordPress's get_option() function, but it uses its own database table instead of wp_options table

Parameters

  • $optionName string required
  • $default mixed

Return mixed

# fluentcrm_update_option

Update FluentCRM Option. This is similar to WordPress's update_option() function, but it uses its own database table instead of wp_options table

Parameters

  • $optionName string required
  • $value mixed

Return INT updated uption id

# fluentcrm_delete_option

Delete FluentCRM Option. This is similar to WordPress's delete_option() function, but it uses its own database table instead of wp_options table

Parameters

  • $optionName string required

Return boolean

# fluentcrm_get_campaign_meta

Get Campaign Meta value or Model by campaign id and key

Parameters

  • $campaignId int required
  • $key string required
  • $returnValue `boolean' If true then it will return the value otherwise returns Meta Model

Return mixed

# fluentcrm_update_campaign_meta

Update Campaign Meta

Parameters

  • $campaignId int required
  • $key string required, Meta Key of the campaign
  • $value `mixed'

Return \FluentCrm\App\Models\Meta Model

# fluentcrm_delete_campaign_meta

Delete Campaign Meta

Parameters

  • $campaignId int required
  • $key string required, Meta Key of the campaign

Return Boolean

# fluentcrm_get_subscriber_meta

Get Contact's Meta Value

Parameters

  • $subscriberId int required
  • $key string required, Meta Key of the subscriber
  • $deafult mixed default value if no meta found

Return mixed

# fluentcrm_update_subscriber_meta

Update Contact's Meta Value

Parameters

  • $subscriberId int required
  • $key string required, Meta Key of the subscriber
  • $value mixed value of the meat

Return \FluentCrm\App\Models\SubscriberMeta

# fluentcrm_delete_subscriber_meta

Delete Subscriber's Meta

Parameters

  • $subscriberId int required
  • $key string required, Meta Key of the campaign

Return Boolean

# fluentcrm_subscriber_statuses

Get Contact Statuses.

Parameters

  • $isOptions boolean if true then it will return as options structure array with id, slug, title properties

Return array

Example:

fluentcrm_subscriber_statuses();
//returns
[
    'subscribed',
    'pending',
    'unsubscribed',
    'bounced',
    'complained'
]

fluentcrm_subscriber_statuses(true);
// returns
[
    [
        'id' => 'subscribed',
        'title' => 'Subscribed',
        'slug' => 'subscribed'
    ],
    .....,
    .....
]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Available Filter Hook: fluent_crm/contact_statuses

# fluentcrm_subscriber_editable_statuses

Get Contact Statuses except bounced and complained

Parameters

  • $isOptions boolean if true then it will return as options structure array with id, slug, title properties

Return array

Available Filter Hook: fluent_crm/contact_editable_statuses

# fluentcrm_contact_types

Get Contact Types as array

Parameters

  • $isOptions boolean if true then it will return as options structure array with id, slug, title properties

Return array

Example:

fluentcrm_contact_types();
//returns
[
    'lead'     => 'Lead',
    'customer' => 'Customer'
]

fluentcrm_contact_types(true);
// returns
[
    [
        'id' => 'lead',
        'title' => 'Lead',
        'slug' => 'lead'
    ],
    .....
]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Available Filter Hook: fluentcrm_contact_types

# fluentcrm_activity_types

Get Contact Note Activity Types items as array

Return array

Source:

function fluentcrm_activity_types()
{
    return apply_filters('fluentcrm_contact_activity_types', [
        'note'              => __('Note', 'fluent-crm'),
        'call'              => __('Call', 'fluent-crm'),
        'email'             => __('Email', 'fluent-crm'),
        'meeting'           => __('Meeting', 'fluent-crm'),
        'quote_sent'        => __('Quote: Sent', 'fluent-crm'),
        'quote_accepted'    => __('Quote: Accepted', 'fluent-crm'),
        'quote_refused'     => __('Quote: Refused', 'fluent-crm'),
        'invoice_sent'      => __('Invoice: Sent', 'fluent-crm'),
        'invoice_part_paid' => __('Invoice: Part Paid', 'fluent-crm'),
        'invoice_paid'      => __('Invoice: Paid', 'fluent-crm'),
        'invoice_refunded'  => __('Invoice: Refunded', 'fluent-crm'),
        'transaction'       => __('Transaction', 'fluent-crm'),
        'feedback'          => __('Feedback', 'fluent-crm'),
        'tweet'             => __('Tweet', 'fluent-crm'),
        'facebook_post'     => __('Facebook Post', 'fluent-crm')
    ]);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Available Filter Hook: fluentcrm_contact_activity_types

# fluentcrm_get_current_contact

Get Current Contact based on the current userID or contact from the cookie value

@return false|object \FluentCrm\App\Models\Subscriber

# fluentcrm_get_crm_profile_html

Get FluentCRM's contact profile widget HTML

Parameters

  • $userIdOrEmail int|string User ID or email address of the contact
  • $checkPermission boolean Whether to check current user's permission
  • $withCss boolean Whether to include CSS

@return false|string HTML of the contact's profile widget

# fluentcrm_get_custom_contact_fields

Get Custom Fields schema for contacts

# fluentCrmGetContactSecureHash

Get unique long hash of a contact which can be used to identify the contact for various usage when is not logged in.