Forked from
Documentation / Docs / Developer Documentation
1557 commits behind the upstream repository.
-
Sean Madsen authored
- Keep the summary short - Use a separate "Notes" section for overflow
Sean Madsen authored- Keep the summary short - Use a separate "Notes" section for overflow
hook_civicrm_notePrivacy.md 1.19 KiB
hook_civicrm_notePrivacy
Summary
This hook provides a way to override the default privacy behavior for notes.
Notes
If a user has the "View All Notes" permission, this hook is bypassed.
See also this blog post.
Availability
This hook is available in CiviCRM 3.3+.
Definition
hook_civicrm_notePrivacy(&$noteValues)
Parameters
- array
$noteValues
- The values from an object of typeCRM_Core_DAO_Note
, converted to an array.
Returns
NULL
Example
function civitest_civicrm_notePrivacy(&$noteValues) {
/* CiviCRM will check for existence of $note['notePrivacy_hidden'].
* If this value is not set, CiviCRM will show or display the note
* based on the default, which is to display private notes only to
* the note author.
* If this value is set, CiviCRM will hide the note if the value is
* TRUE, and display the note if the value is FALSE.
*/
if ($noteValues['is_private']) {
if ($my_business_rules_say_so) {
$noteValues['notePrivacy_hidden'] = TRUE;
}
else {
$noteValues['notePrivacy_hidden'] = FALSE;
}
}
}