AlainBenbassat / eu.businessandcode.notepermissions

Other
0 stars 4 forks source link

hook_civicrm_notePrivacy deprecated in Civi 5.67 #3

Closed MegaphoneJon closed 12 months ago

MegaphoneJon commented 12 months ago

Hi Alain,

Do you have current plans to update this to use hook_civicrm_aclSelectWhereClause? https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_notePrivacy/#before

AlainBenbassat commented 12 months ago

Thanks for the fix. It's now in version 1.2 of this extension.

AlainBenbassat commented 12 months ago

@MegaphoneJon I had to make a fix for pre 5.67 versions. hook civicrm_selectWhereClause() expects 2 parameters, in 5.67 it expects 4 parameters. So I added a default value for $userId and $conditions. If $userId === 0, I fill in the ID of the current contact.

colemanw commented 11 months ago

@AlainBenbassat to prevent edgey bugs I would recommend a default of null instead of 0 for $userId. The convention in Civi's permission system is that a contact_id of NULL means "current user" and 0 means "anonymous".