Created
April 5, 2016 15:43
-
-
Save mecachisenros/785d9d8eef15359b4f66a332406b7b0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myextension_civicrm_contact_get_displayname(&$display_name, $contactId, $objContact) { | |
$membership_id = civicrm_api3('Membership', 'get', array( | |
'sequential' => 1, | |
'contact_id' => $contactId, | |
'return' => 'id', | |
)); | |
if($membership_id['is_error'] == true || $membership_id['count'] !== 0){ | |
$display_name = $display_name . ' - Member ID: '.$membership_id['values'][0]['id']; | |
} else { | |
$display_name = $display_name; | |
} | |
} |
Hi Andrei,
This seems to exactly the thing I need for my CiviCRM (under WordPress) but I'm absolute newbie on hooks. Where do I put the code you have there?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Implements hook_civicrm_contact_get_displayname to display the Member Id if the contact has a Membership