1

I'm writing a custom data extension and I would like to show some things on the Contact Dashboard (not the 'full' dashboard).

I see the hook for the regular Dashboard and Dashlets, but nothing to output anything on the UserDashBoard

CRM/Contact/UserDashboard.php seems to eventually call a lot of hardcoded functions for components.

I've gotten to hook_civicrm_pageRun where I can add stuff by doing this: if ($page->getVar('_name') == "CRM_Contact_Page_View_UserDashBoard") and then simply echo-ing stuff but that doesn't seem to be the 'correct' way of doing things, the CSS doesn't get applied correctly etc.

I've also tried to create a page (using civix generate:page) and then adding UserDashboard.php and tpl files similar to how CRM/Events does it but that doesn't seem to get called at all. I see in Core Components a function named getDashboardObject but there is virtually no documentation, no comments or a way of calling it from within an extension.

I'm trying to affect the User Dashboard which gets generated at http://site/civicrm/user

  • Please clarify exactly which screen in Civi you want to affect. – Coleman Mar 11 '16 at 13:49
2

By contact dashboard, do you mean the contact summary? In that case, there is a hook for that:

https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_summary

Can you try to see if it alters the page you want?

Otherwise and more generally, they are two "catch all" hooks for the ui, one for page https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pageRun (likely the one you need) and one for form
https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterContent

With these two, you should be able to modify pretty much any content generated by civi

  • No it is not the contact summary, it is the contact dashboard at site/civicrm/user I was able to find the page using pageRun (as I mentioned in my post) but that seems like an ugly hack because it parses the code every single page that gets called and it also does not influence the actual page that gets generated, it can only insert content outside the "content div" – Guru Evi Mar 13 '16 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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