How can you edit the end date for an auto-renew membership?
I've raised this as issue #1126 in GitLab. From the discussion, it appears that this was implemented as a 'feature' in the past but it is unclear why this was necessary. Hopefully this issue will be resolved at some point in the future but this may take some time as we need to ensure that it won't cause a regression for existing users.

As a workaround in the meantime, this issue can be resolved by either by making some minor changes to a core file or creating an extension that undoes the core behaviour and makes the fields editable.

The relevant core file is CRM/Member/Form/Membership.php. The class in this file checks to see if the membership is related to a recurring contribution. If so, it prevents users from editing certain fields by freezing them. To prevent this behaviour you can simply search for and comment out the lines with 'freeze' in them.

These are the relevant lines:


line 217: $this-&gt;entityFields['end_date']['is_freeze'] = TRUE;
line 584: $sel-&gt;freeze();
line 611: $statusOverride-&gt;freeze();


Obviously, do some testing on a copy of your site before implementing this to make sure it doesn't cause any issues!

Update 19 October 2019

A fix has been merged into CiviCRM core (PR #15540) that fixes this issue for the end date field. This fix should be included in CiviCRM 5.20.

A separate issue (#1331) has been raised in Git Lab for the other fields that are also frozen (Membership Organisation, Membership Type, Membership Status).

Update 23 March 2020

A fix for the Membership Organisation, Membership Type and Membership Status has been merged into core (PR #16609). This fix should be included in CiviCRM 5.25