# FluentCRM Filter Hooks

FluentCRM Core Intermediate

FluentCRM has many interesting filer hooks that let developers change default settings and even extend FluentCRM with new functionality.

# What are Filter Hooks

A hook is a feature that allows developers to manipulate functionality without modifying core files. A hook can help developers inject some functions or edit default settings.

Filter hooks are used to return modified values for certain parameters, based on different factors.

# Available Filter Hooks

# General Filters


fluent_crm/disable_global_search

By Default FluentCRM provides you a search bar when for easily search contacts and access FluentCRM pages. If you want to remove this feature you can use this hook

Parameters

  • $status Boolean - Default false

Usage:

/*
* Disable FluentCRM search on admin bar
*/
add_filter('fluent_crm/disable_global_search', function($status) {
   return true;
});
1
2
3
4
5
6
fluent_crm/will_auto_unsubscribe

By Default FluentCRM ask the reason to unsubscribe but if you want to disable that and automatically unsubscribe without showing the form then you can use this hook

Parameters

  • $status enum - 'yes' or 'no', Default 'no'

Usage:

/*
* Disable FluentCRM search on admin bar
*/
add_filter('fluent_crm/will_auto_unsubscribe', function($status) {
   return 'yes';
});
1
2
3
4
5
6
fluent_crm/will_use_cookie

By Default FluentCRM set cookie when someone click a link to track further actions like purchase and track revenue for that email campaign / sequence / automation.

Parameters

  • $status boolean

    Usage:

    Attention

    If you use the code snippet, no revenue report will be recorded

     /*
     * Disable Cookie 
     */
     add_filter('fluent_crm/will_use_cookie', function($status) {
        return false;
     });
    
    1
    2
    3
    4
    5
    6
fluent_crm/is_simulated_mail

If you want to simulate all email sending from FluentCRM then you can use this hook.

Parameters

  • $status boolean
  • $data Email Data
  • $headers Email Headers

Usage:

Attention

If you use the code snippet, no email will be sent from FluentCRM

```php 
/*
* Disable Email 
*/
add_filter('fluent_crm/is_simulated_mail', function($status) {
   return true;
});
```
fluent_crm/countries

If you alter the country lists of FluentCRM then you may use this filter.

Parameters

  • $countries Array

Usage:

add_filter('fluent_crm/countries', function($countires) {
  // Process the conutries
  
  return $countries;
}, 20); // priority need to be greated than 10
1
2
3
4
5

# Frontend Filters


fluent_crm/unsubscribe_texts

If you want to customize the labels on Unsubscribe page then you can use this filter hook.

Parameters

  • $texts Array - Labels and texts of the unsubscribe page form
  • $subscriber Subscriber Model - Current Subscriber who is unsubscribing now
$texts = [
  'heading'             => __('Unsubscribe', 'fluent-crm'),
  'heading_description' => __('We\'re sorry to see you go!', 'fluent-crm'),
  'email_label'         => __('Your Email Address', 'fluent-crm'),
  'reason_label'        => __('Please let us know a reason', 'fluent-crm'),
  'button_text'         => __('Unsubscribe', 'fluent-crm')
];
1
2
3
4
5
6
7

Usage:

/*
* Alter Button Text of Unsubscribe form
*/
add_filter('fluent_crm/unsubscribe_texts', function($texts, $subscriber) {
   $texts['button_text'] = 'Unsubscribe (No email updates)';
   return $texts;
}, 10, 2);
1
2
3
4
5
6
7
fluent_crm/unsub_response_message

After a contact unsubscribe and if you want to change the response message programmatically you may use this hook.

Parameters

  • $message String - After Unsubscribe Response Message
  • $subscriber Subscriber Model - Current Subscriber who is unsubscribing now

Usage:

/*
* Change Unsubscribe Response Text
*/
add_filter('fluent_crm/unsubscribe_texts', function($message, $subscriber) {
   rerurn 'You are unsubscribed and no further email will be sent';
}, 10, 2);
1
2
3
4
5
6
fluent_crm/unsub_redirect_url

After a contact unsubscribe and if you want to redirect the contact programmatically then you can use this hook

Parameters

  • $redirectUrl String URL - After Unsubscribe Redirect URL
  • $subscriber Subscriber Model - Current Subscriber who is unsubscribing now

Usage:

/*
* Change Unsubscribe Redirect URL
*/
add_filter('fluent_crm/unsub_redirect_url', function($redirectUrl, $subscriber) {
   rerurn 'https://domain.com/path-to-my-custom-redirect';
}, 10, 2);
1
2
3
4
5
6
fluent_crm/double_optin_options

After Double Optin Confirmation, if you want to change the default behavior (like redirect to a different URL or show different content) then you can use this filter hook

Parameters

  • $config Array - Settings of the default response config including redirect URL
  • $subscriber Subscriber Model - Current Subscriber who is unsubscribing now
$config = [
  'after_confirmation_type' => 'redirect', // or message
  'after_confirm_message'     => 'MESSAGE_DEFINED_IN_SETTINGS',
  'after_conf_redirect_url'   => 'URL DEFINED IN SETTINGS',
];
1
2
3
4
5

Usage:

/*
* Redirect to custom URL after DOI confirmation
*/
add_filter('fluent_crm/double_optin_options', function($config, $subscriber) {
   $config['after_confirmation_type'] = 'redirect';
   $config['after_conf_redirect_url'] = 'https://domain.com/path-to-confirm-page';
   return $config;
}, 10, 2);
1
2
3
4
5
6
7
8
fluent_crm/pref_labels

Manage Subscription Page Labels Filter Hook

Parameters

  • $labels - Manage Subscription Page Labels
$labels = [
    'first_name'      => __('First Name', 'fluent-crm'),
    'last_name'       => __('Last Name', 'fluent-crm'),
    'prefix'          => __('Title', 'fluent-crm'),
    'email'           => __('Email', 'fluent-crm'),
    'phone'           => __('Phone/Mobile', 'fluent-crm'),
    'dob'             => __('Date of Birth', 'fluent-crm'),
    'address_line_1'  => __('Address Line 1', 'fluent-crm'),
    'address_line_2'  => __('Address Line 2', 'fluent-crm'),
    'city'            => __('City', 'fluent-crm'),
    'state'           => __('State', 'fluent-crm'),
    'postal_code'     => __('ZIP Code', 'fluent-crm'),
    'country'         => __('Country', 'fluent-crm'),
    'update'          => __('Update info', 'fluent-crm'),
    'address_heading' => __('Address Information', 'fluent-crm'),
    'list_label'      => __('Mailing List Groups', 'fluent-crm'),
];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Usage:

/*
* Alter Labels of the form
*/
add_filter('fluent_crm/pref_labels', function($labels) {
    $labels['update'] = 'Update My Profile';
    return $labels;
});
1
2
3
4
5
6
7
fluent_crm/pref_form_fields

Manage Subscription Shortcode Fields customization Hook

Parameters

  • $formFields - Manage Subscription Form Fields Array
  • $subscriber - Current Subscriber

Usage:


add_filter('fluent_crm/pref_form_fields', function($formFields, $subscriber) {
   // Customize the $formFields and return
   
   return $formFields;
}, 10, 2);
1
2
3
4
5
6
fluent_crm/show_unsubscribe_on_pref

By Default FluentCRM does not show unsubscribe button on Manage Subscription Page

Parameters

  • $status - Boolean

Usage:

// Show Unsubscribe Button on Manage Subscription Page
add_filter('fluent_crm/show_unsubscribe_on_pref', function($status) {
   return true;
});
1
2
3
4
fluent_crm/double_optin_email_subject

You can customize the double optin email subject from settings page but if you want to alter that then you can use this hook.

Parameters

  • $emailSubject - String
  • $subscriber - Subscriber Model

Usage:

add_filter('fluent_crm/double_optin_email_subject', function($emailSubject, $subscriber) {
   // do you staff
   
   return $emailSubject;
}, 10, 2);
1
2
3
4
5
fluent_crm/double_optin_email_body

You can customize the double optin email body from settings page but if you want to alter that then you can use this hook.

Parameters

  • $emailBody - String
  • $subscriber - Subscriber Model

Usage:

add_filter('fluent_crm/double_optin_email_body', function($emailBody, $subscriber) {
   // do you staff
   
   return $emailBody;
}, 10, 2);
1
2
3
4
5

# Admin Dashboard Filters


fluent_crm/dashboard_stats

If you want to add or remove dashboard stats cards then you can use this filter.

Parameters

  • $stats Array - Dashboard stats cards as containing each stat
$stat = [
    'title' => 'Stat Title',
    'count' => 1234,
    'route' => [
        'name' => 'dashboard' // fluentcrm route to reditect once click. Leave blank if not route
    ]
];
1
2
3
4
5
6
7

Usage:

/*
* Add Own Stat
*/
add_filter('fluent_crm/dashboard_stats', function($stats) {
   $stats['my_stat_key'] = [
        'title' => 'Stat Title',
        'count' => 1234
   ];
   return $stats;
});
1
2
3
4
5
6
7
8
9
10
fluent_crm/quick_links

if you want to customize quick links of FluentCRM Dashboard then use this hook.

Parameters

  • $links Array - Dashboard stats cards as containing each $link
$link = [
    'title' => 'Link Title',
    'url'   => https://domain.com/path-to-link'',
    'icon'  => 'el-icon-user' // optional
]; 
1
2
3
4
5

Usage:

/*
* Add Own Link
*/
add_filter('fluent_crm/quick_links', function($links) {
   $links[] = [
        'title' => 'Link Title',
        'url'   => https://domain.com/path-to-link'',
        'icon'  => 'el-icon-user' // optional
   ];
   return $links;
});
1
2
3
4
5
6
7
8
9
10
11
fluent_crm/dashboard_notices

If you want to show notices to FluentCRM admin panel then you may use this hook.

Parameters

  • $notices Flat Array

Usage:

/*
* Add Custom Notice
*/
add_filter('fluent_crm/dashboard_notices', function($notices) {
   $notices[] = '<p>My Custom Notice Here</p>';
   return $notices;
});
1
2
3
4
5
6
7
fluent_crm/sales_stats

If you want to add custom sales stats on FluentCRM Dashboard widget then use this hook.

Parameters

  • $stats Array

Usage:

/*
* Add Custom Sales Stat
*/
add_filter('fluent_crm/sales_stats', function($stats) {
  $stats[] = [
        'title' => 'Custom Stat Title',
        'content' => 'Stat Content'
  ];
  
  return $stats;
});
1
2
3
4
5
6
7
8
9
10
11

# Other Useful Filters


fluent_crm/enable_unsub_header

By Default FluentCRM include unsubscribe header to marketing emails. If you don't want to include the unsubscribe-list header, you can use this hook.

Parameters

  • $status Boolean - Default false

Usage:

/*
* Disable FluentCRM Unsubscribe-List header
*/
add_filter('fluent_crm/enable_unsub_header', function($status) {
   return false;
});
1
2
3
4
5
6
fluent_crm/email_headers

If you want to add custom email (mime) header you can use this hook

Parameters

  • $headers array
  • $data array - Email Data

Usage:

/*
* Add Custom Header to FluentCRM Email Mime
*/
add_filter('fluent_crm/enable_unsub_header', function($headers, $data) {
   // Add or remove headers
   
   return $headers;
}, 10, 2);
1
2
3
4
5
6
7
8
fluent_crm/enable_mailer_to_name

By Default FluentCRM include name of the contact when sending emails for better deliverability, if you want to disable that, you can use this hook

Parameters

  • $status Boolean - Default false

Usage:

/*
* Disable FluentCRM Name to Email
*/
add_filter('fluent_crm/enable_mailer_to_name', function($status) {
   return false;
});
1
2
3
4
5
6
fluent_crm/user_permissions

You can customize the user's permission set from FluentCRM settings page. But if you want to customize that from code level you can use this hook.

Parameters

  • $permissions Flat Array - Permission Array
  • $wpUser \WP_User - WordPress User

Usage:

/*
* Customize Permissions
*/
add_filter('fluent_crm/user_permissions', function($permissions, $wpUser) {
   // Customize the permission for specific user and then return
   return $permissions;
}, 10, 2);
1
2
3
4
5
6
7
fluent_crm/default_email_design_template

If you want to change the default email design template, you may use this hook.

Parameters

  • $designTemplateSlug string - Default 'simple'

Usage:

/*
* Change Email Template Type to classic
*/
add_filter('fluent_crm/default_email_design_template', function($designTemplateSlug) {
   return 'classic';
});
1
2
3
4
5
6
fluent_crm/contact_name_prefixes

By Default FluentCRM name prefixes are Mr, Mrs and Ms, You want to remove or add your own name prefixes here.

Parameters

  • $namePrefixes array

Usage:

/*
* Add More Name Prefixes
*/
add_filter('fluent_crm/contact_name_prefixes', function($namePrefixes) {
   $namePrefixes[] = 'Dr';
   $namePrefixes[] = 'Engg.';
   
   rerturn $namePrefixes;
});
1
2
3
4
5
6
7
8
9
fluent_crm/woo_purchase_sidebar_html

When you view a contact then it shows related woocommerce data for the contact. You may customize that here

Parameters

  • $sidebarHtml string - HTML
  • $subscriber Subscriber Model
  • $pageNumber INT - Pagination Page Number

Usage:

/*
* Add Custom Data to sidebar HTML of Contact Woo Summary
*/
add_filter('fluent_crm/woo_purchase_sidebar_html', function($sidebarHtml, $subscriber, $pageNumber) {
   if(!$sidebarHtml) {
        return ''; // No info found
   }
   
   $sidebarHtml .= '<p>My custom info</p>';
}, 20, 3);
1
2
3
4
5
6
7
8
9
10
fluent_crm/edd_purchase_sidebar_html

When you view a contact then it shows related Easy Digital Downloads data for the contact. You may customize that here

Parameters

  • $sidebarHtml string - HTML
  • $subscriber Subscriber Model
  • $pageNumber INT - Pagination Page Number

Usage:

/*
* Add Custom Data to sidebar HTML of Contact EDD Summary
*/
add_filter('fluent_crm/edd_purchase_sidebar_html', function($sidebarHtml, $subscriber, $pageNumber) {
   if(!$sidebarHtml) {
        return ''; // No info found
   }
   
   $sidebarHtml .= '<p>My custom info</p>';
}, 20, 3);
1
2
3
4
5
6
7
8
9
10


fluent_crm/incoming_webhook_data

If you want to intercept incoming Webhook before it's get validated and processed you can use this hook to format the data.

Parameters

  • $postData array - Posted data on the webhook
  • $webhook Webhook Model
  • $request Request Object

Usage:

/*
* Customize Webhook data for webhook id: 1
*/
add_filter('fluent_crm/incoming_webhook_data', function($postedData, $webhook) {
   if($webhook->id != 1) {
        return $postedData;
   }
   
   // Customize your $postedData and return
   
    return $postedData;
}, 10, 3);
1
2
3
4
5
6
7
8
9
10
11
12
fluent_crm/webhook_contact_data

FluentCRM Webhook data has been formatted at this point. If you want to alter the contact data and associated tags, lists, statuses, etc. You may use this hook

Parameters

  • $data Array - Formatted Contact data that will be used to create or update a contact
  • $postedData Array - Original Post Data
  • $webhook Related Webhook Model

Usage:

add_filter('fluent_crm/webhook_contact_data', function($data, $postedData, $webhook) {
    // Customize the $data and return
    
    return $data;
}, 10, 3);
1
2
3
4
5