Answers.Body: <p>Even if you don't use a price set on a contribution page, the options that get presented end up being treated as a price set in the database.  Membership options in a price set don't need to be the minimum value of the membership itself, so my suspicion is that your hook isn't affecting the price options on the page, since they're set when you create the contribution page itself.</p>
  
  <p>You'll need to use <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildAmount" rel="nofollow">hook_civicrm_buildamount</a> to change the actual price options' values on the form.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-15T19:17:31.453Z
Answers.Text: Appreciate the help Andrew...the buildAmount hook took care of it.
Answers.UserDisplayName: Ken Truesdale
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-15T14:27:50.160Z
Answers.LastActivityDate: 2015-06-15T14:27:50.160Z
Answers.UserDisplayName: Andie Hunt
Body: <p>I'm attempting to setup proration on fixed memberships via the civicrm_membershipTypeValues hook.  I'm assuming that once the minimum_fee value is modified, this new amount should display on the contribution form.</p>
  
  <p>In using the basic test code, with some debug messages inserted, I can see the hook is called, and the minimum fee value is updated, however the radio button selections for the membership types, retains its original "full period" price.</p>
  
  <p>Currently testing with the following on Drupal 7.37/Civi 4.6.3 to test the ability to update the amount without success....</p>
  
  <p>Appreciate any thoughts on how to implement proration....</p>
  
  <pre><code>function prorated_memberships_civicrm_membershipTypeValues( &amp;$form, &amp;$membershipTypeValues ) {
    require_once "CRM/Core/Error.php";
  
      foreach ( $membershipTypeValues as &amp;$values) {
     CRM_Core_Error::debug( 'olddump', $values);
            if ( $values['name'] == 'General') {
                $values['minimum_fee'] = "5.55";
  
            }
            if ( $values['name'] == 'Family') {
                $values['minimum_fee'] = "2.22";
  
            }
     CRM_Core_Error::debug( 'newdump', $values);
      }
  }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-15T00:21:38.990Z
Comments.Text: Code nitpick: CiviCRM uses a php class autoloader which makes lines like `require_once "CRM/Core/Error.php";` redundant.
Comments.UserDisplayName: Coleman
Tags: <civimember><hooks>
Title: Membership proration
ThreadText: # Membership proration
  
  (Asked by: username_0 on 2015-06-14)
  
  I'm attempting to setup proration on fixed memberships via the civicrm_membershipTypeValues hook.  I'm assuming that once the minimum_fee value is modified, this new amount should display on the contribution form.
  In using the basic test code, with some debug messages inserted, I can see the hook is called, and the minimum fee value is updated, however the radio button selections for the membership types, retains its original "full period" price.
  Currently testing with the following on Drupal 7.37/Civi 4.6.3 to test the ability to update the amount without success....
  Appreciate any thoughts on how to implement proration....
  function prorated_memberships_civicrm_membershipTypeValues( &$form, &$membershipTypeValues ) {
    require_once "CRM/Core/Error.php";
  
      foreach ( $membershipTypeValues as &$values) {
     CRM_Core_Error::debug( 'olddump', $values);
            if ( $values['name'] == 'General') {
                $values['minimum_fee'] = "5.55";
  
            }
            if ( $values['name'] == 'Family') {
                $values['minimum_fee'] = "2.22";
  
            }
     CRM_Core_Error::debug( 'newdump', $values);
      }
  }
  
  **Tags:** civimember, hooks
  
  > **Comments:**
  > **username_1**: Code nitpick: CiviCRM uses a php class autoloader which makes lines like `require_once "CRM/Core/Error.php";` redundant.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-06-15. Score: 2 | Accepted answer
  
  Even if you don't use a price set on a contribution page, the options that get presented end up being treated as a price set in the database. Membership options in a price set don't need to be the minimum value of the membership itself, so my suspicion is that your hook isn't affecting the price options on the page, since they're set when you create the contribution page itself.
  
  You'll need to use [hook\_civicrm\_buildamount](http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildAmount) to change the actual price options' values on the form.
  
  > **Comments:**
  > **username_0**: Appreciate the help Andrew...the buildAmount hook took care of it.  
  
  ---
  
  