Answers.Body: <p>With Drupal webforms I am pretty sure you can set the Membership Type to be locked so renewing folk won't be able to change from the one that loads - will only work if they are logged in or using a checksum.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T02:48:24.903Z
Answers.Text: I did not know that :-) Cool
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T11:49:03.460Z
Answers.Text: "Locked fields" seems to only be a feature of the existing contact itself.  But setting membership type to 'user select' and then changing the widget type to 'hidden' seems to have a similar effect.  Or did you mean something else Pete?
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T19:59:29.747Z
Answers.Text: I meant "changing the widget type to 'hidden'" - if that works I should change the answer
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-06T23:25:46.220Z
Answers.Text: Is there any solution for Wordpress?
Answers.UserDisplayName: Marian Zastawny
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-07T03:06:22.120Z
Answers.Text: if there is it will involve Caldera Forms
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-12T20:27:38.273Z
Answers.LastActivityDate: 2019-06-12T20:27:38.273Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>The key bits are:</p>
  
  <pre><code>function membershipcards_civicrm_buildForm_CRM_Contribute_Form_Contribution_Main(&amp;$form) { 
  
    $currentMemberships = array_keys($form -&gt;_currentMemberships);
    // Assuming there is only 1 current Membership - display it (first result):
    $currentMembershipID = $currentMemberships[0];
    // price_43 -&gt; is element 24 (_label = Membership)
    // price_42 -&gt; is element 25 (_label = Additional Contribution)
    $elementId_membership = $form-&gt;_elementIndex['price_43'];
    $elementId_latefees = $form-&gt;_elementIndex['price_42'];
  
    foreach ($form-&gt;_elements[$elementId_membership]-&gt;_elements as $key =&gt; $oneMembership) {
      if ($oneMembership-&gt;_attributes['membership-type'] != $currentMembershipID) {
        unset($form-&gt;_elements[$elementId_membership]-&gt;_elements[$key]);
      }
    }
  ...
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-03T00:32:28.877Z
Answers.Text: KarinG - Semper IT,  did you ever take this further? I've got a site where the members start as students, become candidates and then full members and in order to maintain a history, we keep all member records intact rather than just add different membership levels as they progress. By default CiviCRM would like to renew the first membership they ever had so it would be much better to just renew the current. Cheers, Andrew
Answers.UserDisplayName: Andrew Wasson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-03T01:18:31.310Z
Answers.Text: That snippet is from a live site - a professional association. Can't upgrade yourself to be a fully licensed Dental Technologist! So that loads the current Membership and then removes all non-current Membership options from the CiviCRM Contribution form. You can put this into a Drupal module or in an extension.
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-03T02:23:56.783Z
Answers.Text: Nice work! It's exactly what I need. I use Civi for professional associations as well: Planners, Psychologists and Architects. Thanks,
Answers.UserDisplayName: Andrew Wasson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-03T14:46:56.517Z
Answers.Text:  excellent - glad this helped you out
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T12:42:45.677Z
Answers.LastActivityDate: 2019-06-13T12:42:45.677Z
Answers.UserDisplayName: KarinG - Semper IT
Body: <p>How can we ensure members renew as the same membership type?  At initial sign-up, they can choose their type but after that, renewals should be as the same type - they should not be able to renew as a different type.</p>
  
  <p>One option is to create separate contribution pages for each membership type, then have a join page that links to each of those.  And then setup scheduled reminders for each type with links to the contribution page for renewal. With 13 membership types, that's a lot of setup.</p>
  
  <p>So we're looker for a smarter way to do that.  Any ideas or useful extensions?  Drupal system so webforms are an option. </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-13T02:47:52.627Z
Comments.Text: I hear you - we inherited a project that had a one per membership type contribution page for a professional association - I wrote an extension that loads the current membership and then disables all other membership options - very simple and effective - happy to share the essential bits of that extension with you
Comments.UserDisplayName: KarinG - Semper IT
Tags: <civimember><contribution-page>
Title: Membership renewal as same type
ThreadText: # Membership renewal as same type
  
  (Asked by: username_0 on 2019-06-12)
  
  How can we ensure members renew as the same membership type? At initial sign-up, they can choose their type but after that, renewals should be as the same type - they should not be able to renew as a different type.
  
  One option is to create separate contribution pages for each membership type, then have a join page that links to each of those. And then setup scheduled reminders for each type with links to the contribution page for renewal. With 13 membership types, that's a lot of setup.
  
  So we're looker for a smarter way to do that. Any ideas or useful extensions? Drupal system so webforms are an option.
  
  **Tags:** civimember, contribution-page
  
  > **Comments:**
  > **username_1**: I hear you - we inherited a project that had a one per membership type contribution page for a professional association - I wrote an extension that loads the current membership and then disables all other membership options - very simple and effective - happy to share the essential bits of that extension with you  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-06-12. Score: 3
  
  With Drupal webforms I am pretty sure you can set the Membership Type to be locked so renewing folk won't be able to change from the one that loads - will only work if they are logged in or using a checksum.
  
  > **Comments:**
  > **username_1**: I did not know that :-) Cool  
  > **username_0**: "Locked fields" seems to only be a feature of the existing contact itself.  But setting membership type to 'user select' and then changing the widget type to 'hidden' seems to have a similar effect.  Or did you mean something else Pete?  
  > **username_2**: I meant "changing the widget type to 'hidden'" - if that works I should change the answer  
  > **username_3**: Is there any solution for Wordpress?  
  > **username_2**: if there is it will involve Caldera Forms  
  
  ---
  
  ### Answer by username_1 on 2019-06-13. Score: 1
  
  The key bits are:
  function membershipcards_civicrm_buildForm_CRM_Contribute_Form_Contribution_Main(&$form) { 
  
    $currentMemberships = array_keys($form ->_currentMemberships);
    // Assuming there is only 1 current Membership - display it (first result):
    $currentMembershipID = $currentMemberships[0];
    // price_43 -> is element 24 (_label = Membership)
    // price_42 -> is element 25 (_label = Additional Contribution)
    $elementId_membership = $form->_elementIndex['price_43'];
    $elementId_latefees = $form->_elementIndex['price_42'];
  
    foreach ($form->_elements[$elementId_membership]->_elements as $key => $oneMembership) {
      if ($oneMembership->_attributes['membership-type'] != $currentMembershipID) {
        unset($form->_elements[$elementId_membership]->_elements[$key]);
      }
    }
  ...
  
  > **Comments:**
  > **username_4**: username_1,  did you ever take this further? I've got a site where the members start as students, become candidates and then full members and in order to maintain a history, we keep all member records intact rather than just add different membership levels as they progress. By default CiviCRM would like to renew the first membership they ever had so it would be much better to just renew the current. Cheers, Andrew  
  > **username_1**: That snippet is from a live site - a professional association. Can't upgrade yourself to be a fully licensed Dental Technologist! So that loads the current Membership and then removes all non-current Membership options from the CiviCRM Contribution form. You can put this into a Drupal module or in an extension.  
  > **username_4**: Nice work! It's exactly what I need. I use Civi for professional associations as well: Planners, Psychologists and Architects. Thanks,  
  > **username_1**:  excellent - glad this helped you out  
  
  ---
  
  