Multisite: dashlet irregular behavior
Within a multisite instance, the civicrm_dashboard_contact
behavior is a bit odd with a new twist with SK dashlets switching domains in civicrm_dashboard
. Examining the behavior of both CiviReport dashlets and Search Kit, below:
CiviReport Dashlets
If you add a CiviReport to via "Available for Dashboard?", observe that it adds a row in civicrm_dashboard_contact
for all users of multisite, not just those in your domain, even though CiviReports is domain-aware (this also occurs with SK dashlets). This occurs on all domains generating dashboards.
Within civicrm_dashboard
, 1 entry exists for the domain it was created on, so there is no linkage for the dashlet to show on any of the domains even though it is added in civicrm_dashboard_contact
. Therefore, it does not show for those users.
Search Kit Dashlets
One feature that would be powerful to have is to have global reports in multisite. Good news is Search Kit is close to achieving this, and I currently use a version of this today. You can create a display and link the page with a relative URL in your CMS nav for instance (e.g. /wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fsome-display) and it will be accessible to any domain on your multisite and respect ACL's, etc. However, as with CiviReport, the civicrm_dashboard
is generated for 1 domain. I have done a test of inserting the SK dashboard (cloning in MySQL) on all domains so users now see dashlet in available dashlets. Once they drag it as an active dashlet, it generates the entry in civicrm_dashboard_contact.
That's good :)
However, we observe that domain ID 1 where the dashlet was created with Form Builder, switches the domain ID to the last in the array of domains of the civicrm.settings.php file. This occurs before and after generating an entry for all domains. In this case, See below from the log_civicrm_dashboard
as evidence:
I have been switching it back to domain ID 1, manually. Observe below that even with domain 57 having an entry for the dashboard, it still switched domain ID 1 dashlet to 57, resulting in duplicate dashlets.
For Search Kit dashlets, the behavior that is not clear cut. It can vary and is dependent on if it is intended to be 1) a dashlet for it's domain only, or 2) a global dashlet for all domains. With this in mind, it would NOT be desirous to generate an entry in civicrm_dashboard
for all domains, I think this is best left to inserting directly to MySQL if you intend to make a dashboard for more than 1 domain, or some paid development to enable this. It is similar to how civicrm_navigation
needs to be built when generating a new domain on multisite.
Noting that uf_match
table, adds an entry for domain ID 1 for people that are not users of domain ID 1. Perhaps this i why it is generating dashlets for these. @haystack just noting this may be related to uf_match behavior. I note that currently I have 352 domain ID 1 uf_match
entries but not anywhere near that or ever had a cumulative user count near that number, however it is lower than the total users on all other domains:
Evidence below of 2 entries per user:
Summary of issues:
-
CiviReport / Search Kit dashlets should not generate an entry in civicrm_dashboard_contact
for users not on it's domain (it's harmless, but also nonsensical) -
Search Kit Dashlets via Form Builder switch domain ID (High Priority)