2

I would like to pull through some of the membership details into the summary tab (don't ask... clients...!)

What is the easiest way to do this, as when you are on the summary tab, none of the membership info is assigned to smarty.

This is civicrm 4.5.4

Cheers.

3

Create a new extension and use hook_civicrm_summary which should be of more use and you can add value at any place

Please refer to the following link for more reference http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_summary

  • Agreed with this - use API calls in your hook to handle pulling in the membership info. – Jon G - Megaphone Tech Jul 21 '15 at 15:59
  • I dont need to be able to edit the details from there, just display things like membership type and end date, all editing will still be done from within the membership tab. Clients hey? I haven't done any work with extensions and hooks yet so this will all be new to me going down this route. – Scott Jul 21 '15 at 16:21
1

Alternative if you're just displaying data is to attach some extra smarty code to the end of the summary template using templatename.extra.tpl:

https://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates

You can grab the data from the API in this file using smarty api commands. Then use jQuery to insert it into the summary tab where appropriate.

1

I sort of did just this. Because there is a lot of white space next to the name, we display the membership info after the name.

Because some of our contacts have multiple memberships and we care about the start and end on some of them, I created a view on membership to concatenate the info we wanted to show.

So it shows something like John Smith - Gold '16, Alumni class of '05.

The code for the hook is straight forward. (I can't say the same for the sql for the view):

 function ccas_hooks_civicrm_contact_get_displayname(&$displayname, $contactId, $objContact) {

 $sql = "select affiliations 
         from ccas_affil_alum
         where contact_id = $contactId";

 $affiliations = CRM_Core_DAO::singleValueQuery($sql);

 $displayname = $displayname . ' - '.$affiliations;

}

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.