GroupContact pre/post hooks have inconsistent signatures
Fixing this is going to require breaking the extension contract, so I think it needs core team approval.
I think the inconsistency was introduced as an unintended side effect of...introducing consistency (for API4).
Looking at CRM_Contact_BAO_GroupContact, the
post hooks are called three times each - once in
add(), once in
addContactsToGroup(), once in
// add() CRM_Utils_Hook::pre($hook, 'GroupContact', CRM_Utils_Array::value('id', $params), $params); // addContactsToGroup() and removeContactsFromGroup() CRM_Utils_Hook::pre('create', 'GroupContact', $groupId, $contactIds);
In addition to the change in signature (which will require communication with extension devs) this will probably also introduce a performance hit when removing folks from groups, but that's unavoidable(?).
@jaapjansma this will break CiviRules:
CRM_CivirulesPostTrigger_GroupContact::triggerTrigger() relies on the old signature, which is how I found this.