I want to send a notification to a specific email address when a contact opts out from all bulk mailings. Therefor I tried the hook hook_civicrm_post. This should be triggered when the field "NO BULK EMAILS" gets checked. After submitting the opt-out form, the field "NO BULK EMAILS" is checked in the contact's profile but the hook is not triggered. I tested that with the following code:
function module_name_civicrm_post($op, $objectName, $objectId, &$objectRef){
$dump =
print_r($op, true)
. print_r($objectName, true)
. print_r($objectId, true)
. print_r($objectRef, true);
file_put_contents('/home/civicrm/test/dump.txt', $dump);
}
(I have got write permissions, so that can't be the problem.)
I also changed the field manually in the contact's profile but that also didn't trigger the hook.
Does anyone have an idea why this hook is not invoked or what hook can I use instead?