Answers.Body: <blockquote>
    <p>There was a <a href="https://issues.civicrm.org/jira/browse/CRM-18282?filter=-2" rel="nofollow">bug in this feature</a>. As of CiviCRM version 4.7.5 the following steps will work.</p>
  </blockquote>
  
  <p>The standard civi approach would be</p>
  
  <ul>
  <li>create custom field group and set to be used on Membership</li>
  <li>add custom field</li>
  <li>create Profile to be used on that Contribution page and include the above field.</li>
  </ul>
  
  <p>That is all assuming that the 'field' is actually specific to the Membership and not to the Contact or the Contribution or some other component.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-16T22:42:11.777Z
Answers.Text: I tried on Demo as well but the custom field in the membership stays empty. Do I miss something obvious in the setup? Please have a look: http://dmaster.demo.civicrm.org/civicrm/admin/contribute/custom?reset=1&action=update&id=2
Answers.UserDisplayName: sleidig
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-17T00:00:09.983Z
Answers.Text: looking looking
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-17T00:05:48.720Z
Answers.Text: I concur - info is showing on both Confirmation and Thank you pages!! But not on the membership record. Want to go ahead and report in JIRA with steps to replicate or point here? Added as new answer.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-05T07:43:21.047Z
Answers.Text: I accepted this answer now, as this (soon) should be the way to do it for anyone coming across this question in the future.
Answers.UserDisplayName: sleidig
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-16T20:40:24.447Z
Answers.LastActivityDate: 2016-04-04T13:56:19.773Z
Answers.LastEditDate: 2016-04-04T13:56:19.773Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>Please check the PR: <a href="https://github.com/civicrm/civicrm-core/pull/8052" rel="nofollow">https://github.com/civicrm/civicrm-core/pull/8052</a></p>
  
  <p>The bug mentioned in description is not replicating, but found an additional bug. After making online membership contribution, with custom field included in profile, custom data is not getting saved in fields. When, view a membership record on contact summary page.</p>
  
  <p>So made additional fix for CRM-18282.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-01T11:10:55.457Z
Answers.Text: that PR fixed the problem for me. Thanks a lot! :-)
Answers.UserDisplayName: sleidig
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-01T09:47:36.180Z
Answers.LastActivityDate: 2016-04-01T09:47:36.180Z
Answers.UserDisplayName: 1990rk4
Answers.Body: <p>Adding as separate answer. Appears to be a bug - adding Membership fields, then adding in to Profile. We see them on the form, and the data we enter (both Text and Yes/No) show on the Confirmation page and the Thank you page (see <a href="https://i.sstatic.net/yFXWo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yFXWo.png" alt="screenshot"></a></p>
  
  <p>Needs a JIRA ticket imo.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-23T14:53:03.780Z
Answers.Text: added ticket in JIRA: https://issues.civicrm.org/jira/browse/CRM-18282
  
  thanks for checking and confirming!
Answers.UserDisplayName: sleidig
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-17T00:09:17.923Z
Answers.LastActivityDate: 2016-03-17T00:09:17.923Z
Answers.UserDisplayName: petednz - fuzion
Body: <p>I need to save some additional information related to the membership during sign-up. This will be stored in custom fields of the membership. Sign-up (Membership creation) is happening through a Contribution Page which includes a Profile with those custom fields.</p>
  
  <p>The Profile does not transfer the values from the custom field into the custom field of the newly created Membership.</p>
  
  <p>Previously I used (Drupal Module) custom code and the civicrm_api to update the membership. However, nowadays I don't seem to be able to get the <code>contributionID</code> and <code>membershipID</code> values from the <code>$form-&gt;_params</code> array anymore.</p>
  
  <p><strong>How can I add custom fields to a Membership from a Contribution Page?</strong></p>
  
Tags: <civimember><custom-fields><profile><contribution-page>
Title: Set custom field during Membership signup through a Contribution Page
ThreadText: # Set custom field during Membership signup through a Contribution Page
  
  (Asked by: username_0 on 2016-03-16)
  
  I need to save some additional information related to the membership during sign-up. This will be stored in custom fields of the membership. Sign-up (Membership creation) is happening through a Contribution Page which includes a Profile with those custom fields.
  
  The Profile does not transfer the values from the custom field into the custom field of the newly created Membership.
  
  Previously I used (Drupal Module) custom code and the civicrm\_api to update the membership. However, nowadays I don't seem to be able to get the `contributionID` and `membershipID` values from the `$form->_params` array anymore.
  
  **How can I add custom fields to a Membership from a Contribution Page?**
  
  **Tags:** civimember, custom-fields, profile, contribution-page
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-03-16. Score: 0 | Accepted answer
  
  > There was a [bug in this feature](https://issues.civicrm.org/jira/browse/CRM-18282?filter=-2). As of CiviCRM version 4.7.5 the following steps will work.
  
  The standard civi approach would be
  
  * create custom field group and set to be used on Membership
  * add custom field
  * create Profile to be used on that Contribution page and include the above field.
  
  That is all assuming that the 'field' is actually specific to the Membership and not to the Contact or the Contribution or some other component.
  
  > **Comments:**
  > **username_0**: I tried on Demo as well but the custom field in the membership stays empty. Do I miss something obvious in the setup? Please have a look: http://dmaster.demo.civicrm.org/civicrm/admin/contribute/custom?reset=1&action=update&id=2  
  > **username_1**: looking looking  
  > **username_1**: I concur - info is showing on both Confirmation and Thank you pages!! But not on the membership record. Want to go ahead and report in JIRA with steps to replicate or point here? Added as new answer.  
  > **username_0**: I accepted this answer now, as this (soon) should be the way to do it for anyone coming across this question in the future.  
  
  ---
  
  ### Answer by username_2 on 2016-04-01. Score: 2
  
  Please check the PR: <https://github.com/civicrm/civicrm-core/pull/8052>
  
  The bug mentioned in description is not replicating, but found an additional bug. After making online membership contribution, with custom field included in profile, custom data is not getting saved in fields. When, view a membership record on contact summary page.
  
  So made additional fix for CRM-18282.
  
  > **Comments:**
  > **username_0**: that PR fixed the problem for me. Thanks a lot! :-)  
  
  ---
  
  ### Answer by username_1 on 2016-03-17. Score: 1
  
  Adding as separate answer. Appears to be a bug - adding Membership fields, then adding in to Profile. We see them on the form, and the data we enter (both Text and Yes/No) show on the Confirmation page and the Thank you page (see [![screenshot](https://i.sstatic.net/yFXWo.png)](https://i.sstatic.net/yFXWo.png)
  
  Needs a JIRA ticket imo.
  
  > **Comments:**
  > **username_0**: added ticket in JIRA: https://issues.civicrm.org/jira/browse/CRM-18282  thanks for checking and confirming!  
  
  ---
  
  