8

Can I create a default dashboard setup (active dashlets and arrangement) for all users?

This would greatly improve the usability of the Dashboard, since the dashlets relevant to the use-case of the organization could be configured by an admin and users would see relevant data on their home screen instead of "CiviCRM News" or just this:

Welcome to your Home Dashboard Your dashboard provides a one-screen view of the data that's most important to you. Graphical or tabular data is pulled from the reports you select, and is displayed in 'dashlets' (sections of the dashboard).

3 Answers 3

4

The DefaultDashlets CiviCRM extension creates a settings page that allows administrators to define the active dashlets for new users based on group membership.

Keep in mind it was born some hours ago as part of a CiviCRM developer training exercise. You rock David Hayes!

3

You don't need to use SQL! There is an API and a hook for this, assuming you're on Civi 4.4 or higher.

Check out the DashboardContact API, especially if you're working with contacts that have already been created.

If you're mostly concerned about new users, I'd recommend exploring hook_civicrm_dashboard_defaults.

1
  • Thank you @Jon G, that's better than a SQL query. I am going to look into creating an extension with the API functions you mention.
    – LunkRat
    Commented Mar 26, 2015 at 2:46
1

I'm not aware of a front-end way to set a default, but you can use a SQL query to copy the dashboard setup from your "template" contact to new users as you create them. Below is an example:

insert into civicrm_dashboard_contact (
    dashboard_id,
    contact_id,
    column_no,
    is_minimized,
    is_fullscreen,
    is_active,
    weight,
    content,
    created_date)
select
    dashboard_id,
    35, -- replace with new contact id
    column_no,
    is_minimized,
    is_fullscreen,
    is_active,
    weight,
    content,
    NOW()
from
    civicrm_dashboard_contact 
where 
    contact_id = 1 -- replace with contact id whose dashboard you want to copy
;

If you use a certain contact type/group/tag to define back office users, you can join to the appropriate table and do it all at once rather than one contact at a time.

3
  • Thanks @Nicholai, this is not at all what I wanted to hear, but I am very grateful that you shared this query!
    – LunkRat
    Commented Mar 25, 2015 at 15:21
  • 1
    I guess you could create an extension that do what Nicholai propose automatically when a new contact is created using hook_civicrm_post.
    – samuelsov
    Commented Mar 25, 2015 at 15:44
  • @samuelsov creating an extension is a great idea! Thanks.
    – LunkRat
    Commented Mar 25, 2015 at 15:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.