Answers.Body: <p>This functionality already exists in CiviCRM; however, by default it isn't exposed to the UI.  Look in the database at <code>civicrm_membership_log</code>.</p>
  
  <p>The main difference between what you're describing and what exists is that the contribution isn't tied directly to the <code>civicrm_membership_log</code> record.  Instead of an extension, you may want to extend <code>civicrm_membership_payment</code> to include a foreign key to the appropriate <code>civicrm_membership_log</code> entry.  </p>
  
  <p>Alternatively, you can most likely write an extension to correlate contributions and membership periods in the log by date for display in the UI.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-03T15:58:37.387Z
Answers.LastActivityDate: 2017-08-03T15:58:37.387Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Please check this one: </p>
  
  <p><a href="https://civicrm.org/extensions/membership-periods" rel="nofollow noreferrer">https://civicrm.org/extensions/membership-periods</a></p>
  
  <p>If you would like to create one, you can use this </p>
  
  <p><a href="https://github.com/devarun/org.civicrm.memberrenewallog" rel="nofollow noreferrer">https://github.com/devarun/org.civicrm.memberrenewallog</a></p>
  
  <p>I worked earlier on this but it was not complete, you will need to check everything to start working.</p>
  
  <p>CiviCRM Extensions Developers Guide: </p>
  
  <p><a href="https://docs.civicrm.org/dev/en/master/extensions/civix/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/master/extensions/civix/</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-03T09:29:32.740Z
Answers.LastActivityDate: 2017-08-03T09:44:32.147Z
Answers.LastEditDate: 2017-08-03T09:44:32.147Z
Answers.UserDisplayName: Arun Singh
Body: <p>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.<br>
  The membership period should be connected to a contribution record if a payment is taken for this membership or renewal.<br>
  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:  </p>
  
  <p>Term/Period 1: 1 Jan 2014 - 31 Dec 2015<br>
  Term/Period 2: 1 Jan 2015 - 31 Dec 2016<br>
  Term/Period 3: 1 Jan 2016 - 31 Dec 2017  </p>
  
  <p>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.  </p>
  
  <p>Appreciate the help, please. Thank you.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-03T08:12:52.543Z
Comments.Text: 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.
Comments.UserDisplayName: ErikH - CiviCooP
Tags: <civimember><extension>
Title: CiviCRM membership component
ThreadText: # CiviCRM membership component
  
  (Asked by: username_0 on 2017-08-03)
  
  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.
  
  **Tags:** civimember, extension
  
  > **Comments:**
  > **username_1**: 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.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-08-03. Score: 5
  
  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.
  
  
  ---
  
  ### Answer by username_3 on 2017-08-03. Score: 4
  
  Please check this one:
  
  <https://civicrm.org/extensions/membership-periods>
  
  If you would like to create one, you can use this
  
  <https://github.com/devarun/org.civicrm.memberrenewallog>
  
  I worked earlier on this but it was not complete, you will need to check everything to start working.
  
  CiviCRM Extensions Developers Guide:
  
  <https://docs.civicrm.org/dev/en/master/extensions/civix/>
  
  
  ---
  
  