I need to develop an extension to extend the CiviCRM membership component so that when a membership is created or renewed a record for the membership “period” is recorded.
The membership period should be connected to a contribution record if a payment is taken for this membership or renewal.
i.e. If a membership commenced on 1 Jan 2014 and each term was 12 months in length, by 1 Jan 2016 the member would be renewing for their 3rd term. The terms would be:

Term/Period 1: 1 Jan 2014 - 31 Dec 2015
Term/Period 2: 1 Jan 2015 - 31 Dec 2016
Term/Period 3: 1 Jan 2016 - 31 Dec 2017

Currently, when a membership is renewed in CiviCRM the “end date” field on the membership itself is extended by the length of the membership as defined in CiviCRM membership type configuration but no record of the actual length of any one period or term is recorded. As such it is not possible to see how many “terms” or “periods” of membership a contact may have had.

Appreciate the help, please. Thank you.

  • What is your specific question? How to do this functionally? What code you need? At the moment I think your story is too generic, you will need to narrow it down a little I think. Aug 3, 2017 at 8:12

2 Answers 2


This functionality already exists in CiviCRM; however, by default it isn't exposed to the UI. Look in the database at civicrm_membership_log.

The main difference between what you're describing and what exists is that the contribution isn't tied directly to the civicrm_membership_log record. Instead of an extension, you may want to extend civicrm_membership_payment to include a foreign key to the appropriate civicrm_membership_log entry.

Alternatively, you can most likely write an extension to correlate contributions and membership periods in the log by date for display in the UI.


Please check this one:


If you would like to create one, you can use this


I worked earlier on this but it was not complete, you will need to check everything to start working.

CiviCRM Extensions Developers Guide:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.