Details
Description
I have been looking at implementing the following using the pre hook and have found it is currently impossible to alter the id of the membership being altered
Background:
The purpose of the specific work I'm doing is to accurately show the gap between memberships where there is one. This has been an ongoing 'sticking point' because the default behaviour (extend the expired membership and attempt to demonstrate what has happened by altering the start_date but not the join_date) only suits some organisations.
Issue
The code needs to
1) check if the membership status is expired (or other non-renewable statuses)
2) if so, unset the id of the membership being altered and edit the start_date & join_date to today
The problem is with #2 - currently $id is passed into the pre hook as a non-reference field. $params['id'] can be altered but the alteration is ignored.
I have a patch that 'gets us past this' which I will attach but we should probably get the pattern right. If it involves passing the $id by reference create calls (currently passing NULL) will need to be altered to pass a variable.