Customizing Your FluentCRM Dashboard: How to Personalize Stats Using Filters

FluentCRM provides users with access to a dynamic dashboard that displays essential statistics for efficient management. If you want to customize your FluentCRM dashboard by adding or removing specific stat cards, FluentCRM offers a flexible solution through the fluent_crm/dashboard_stats filter hook. This technical guide explores the parameters and usage of this filter, providing insights on how to seamlessly modify your dashboard stats cards.

Understanding Parameters:
The fluent_crm/dashboard_stats filter takes one parameter:

  1. $stats (Array): An array containing the dashboard stats cards, where each stat is defined by an associative array.
  • $stat (Array): Represents an individual stat card with the following components:
    • title: The title of the stat card.
    • count: The numerical count displayed on the stat card.
    • route: An optional array specifying the route to redirect to when the stat card is clicked. If not needed, this can be left blank.

Usage Example:
To illustrate how this filter can be utilized, consider the following example demonstrating the addition of a custom stat card:

PHP

/*
* Add Own Stat
*/
add_filter('fluent_crm/dashboard_stats', function($stats) {
   $stats['my_stat_key'] = [
        'title' => 'Stat Title',
        'count' => 1234,
        'route' => [
            'name' => 'dashboard' // FluentCRM route to redirect once clicked. Leave blank if not routing.
        ]
   ];
   return $stats;
});

Explanation:

  1. add_filter: This function is used to hook into FluentCRM and modify the specified parameter—fluent_crm/dashboard_stats
  2. $stats[‘my_stat_key’]: This line introduces a custom stat card labeled ‘my_stat_key’ to the existing array of dashboard stats.
  3. ‘title’ and ‘count’: These components define the title and numerical count displayed on the custom stat card.
  4. ‘route’: The optional route array specifies the FluentCRM route to redirect to when the custom stat card is clicked. In this case, it redirects to the ‘dashboard’ route.
  5. return $stats;: Finally, the modified array of dashboard stats cards, including the custom stat, is returned.

Broader Implications:
Customizing dashboard stats cards using the fluent_crm/dashboard_stats filter opens up avenues for organizations to use FluentCRM to their specific needs. Whether it’s displaying user-specific information or highlighting critical performance indicators, this filter enables enterprises to create a dashboard that is personalized to their individual operational needs.

This filter-based approach to personalizing FluentCRM dashboard analytics gives firms a significant tool for creating a bespoke user experience. Organizations may dynamically shape their dashboard by understanding the parameters and employing the fluent_crm/dashboard_stats filter, ensuring that the displayed stats are in line with their developing business priorities.

Similar Posts