Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-11028

hook_civicrm_membershipTypeValues() not always called

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.2
    • Fix Version/s: 4.2.6
    • Component/s: CiviMember
    • Labels:
      None

      Description

      I'm trying to get the cividiscount extension working and I'm having a problem with getting access to pricing for membership purchases. We have overridden hook_civicrm_membershipTypeValues() to modify the price and label of memberships when a discount code is entered. Unfortunately, the hook isn't always called when a membership is purchased.

      Using the main contribution form 'Membership and Renewal' in a standard test site calls the hook, with a flow something like:

      civicrm/contribute/transact?reset=1&id=2 ->
      CRM_Event_Form_Registration_Register ->
      CRM_Member_BAO_Membership::buildMembershipTypeValues() ->
      CRM_Utils_Hook::membershipTypeValues()

      But when I submit a credit card membership using the contact tab form, the hook isn't called. The data flow is something like:

      civicrm/contact/view [submit credit card membership] ->
      civicrm/contact/view/membership?reset=1&action=add&cid=69&context=membership&mode=live
      CRM_Member_Form_Membership ->
      buildCustomData() [ajax call]->
      civicrm/ajax/memType ->
      CRM_Member_Page_AJAX::getMemberTypeDefaults()

      Unfortunately this last call directly injects the price onto the form with no hook called.

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              keith@wellebee.com Keith Morgan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: