Answers.Body: <p>After a long debug analysis I understand that the problem is related to missing linenumber associated to the membership type. I solved saving every records with a price without . (Maybe it is enough to save)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-05T06:21:17.647Z
Answers.LastActivityDate: 2021-10-05T06:21:17.647Z
Answers.UserDisplayName: pk825
Body: <p>After upgrading to 5.41.2 on Wordpress 5.8.1 I still have the problem with manual add a new member.</p>
  <pre><code>ott 04 14:42:55  [error] 
  $Fatal Error Details = array:3 [
    &quot;message&quot; =&gt; &quot;Mandatory key(s) missing from params array: membership_id&quot;
    &quot;code&quot; =&gt; null
    &quot;exception&quot; =&gt; CiviCRM_API3_Exception {#29193
      -extraParams: array:6 [
        &quot;fields&quot; =&gt; array:1 [
          0 =&gt; &quot;membership_id&quot;
        ]
        &quot;error_code&quot; =&gt; &quot;mandatory_missing&quot;
        &quot;entity&quot; =&gt; &quot;MembershipPayment&quot;
        &quot;action&quot; =&gt; &quot;create&quot;
        &quot;is_error&quot; =&gt; 1
        &quot;error_message&quot; =&gt; &quot;Mandatory key(s) missing from params array: membership_id&quot;
      ]
      #message: &quot;Mandatory key(s) missing from params array: membership_id&quot;
      #code: 0
      #file: &quot;/home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/api/api.php&quot;
      #line: 134
      trace: {
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/api/api.php:134 {
          › if (is_array($result) &amp;&amp; !empty($result['is_error'])) {
          ›   throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
          › }
        }
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php:2512 { …}
        /home/gragorg/staging.grag.org/wp-content/uploads/civicrm/custom_php/CRM/Member/Form/Membership.php:1324 { …}
        /home/gragorg/staging.grag.org/wp-content/uploads/civicrm/custom_php/CRM/Member/Form/Membership.php:881 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:526 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:152 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:119 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:352 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/Page/Tab.php:314 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/Page/Tab.php:384 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:313 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm.php:1178 { …}
        /home/gragorg/staging.grag.org/wp-includes/class-wp-hook.php:292 { …}
        /home/gragorg/staging.grag.org/wp-includes/class-wp-hook.php:316 { …}
        /home/gragorg/staging.grag.org/wp-includes/plugin.php:484 { …}
        /home/gragorg/staging.grag.org/wp-admin/admin.php:259 { …}
      }
    }
  ]
  </code></pre>
  <p>The custom php is not relevant: the problem is identical with original file (the custom is very simple and very localized)
  I do more investigation and for me it is strange is the variable is not set and the <a href="https://lab.civicrm.org/dev/core/-/issues/2431" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/-/issues/2431</a> I understand that the problem is related to the form which pass the data. I have printed the values:</p>
  <pre><code>ott 04 15:43:46  [info] $$this-&gt;_params = Array
  (
      [hidden_custom] =&gt; 1
      [hidden_custom_group_count] =&gt; Array
          (
              [] =&gt; 1
          )
  
      [qfKey] =&gt; CRMMemberFormMembership2dowfisuhgsgcs4wo0c4kw08occ0wswo0c0swcw00cc0kc8gkg_9712
      [entryURL] =&gt; https://staging.grag.org/wp-admin/admin.php?page=CiviCRM&amp;amp;q=civicrm%2Fmember%2Fadd&amp;amp;page=CiviCRM&amp;amp;reset=1&amp;amp;action=add&amp;amp;context=standalone
      [join_date] =&gt; 2021-10-04
      [start_date] =&gt; 
      [end_date] =&gt; 
      [price_set_id] =&gt; 
      [contact_id] =&gt; 798
      [max_related] =&gt; 
      [membership_type_id] =&gt; Array
          (
              [0] =&gt; 1
              [1] =&gt; 2
          )
  
      [num_terms] =&gt; 1
      [source] =&gt; 
      [campaign_id] =&gt; 
      [status_id] =&gt; 
      [is_override] =&gt; 
      [status_override_end_date] =&gt; 
      [record_contribution] =&gt; 1
      [total_amount] =&gt; 30,00
      [receive_date] =&gt; 2021-10-04 15:43:00
      [payment_instrument_id] =&gt; 5
      [trxn_id] =&gt; 
      [contribution_status_id] =&gt; 1
      [financial_type_id] =&gt; 2
      [soft_credit_type_id] =&gt; 
      [soft_credit_contact_id] =&gt; 
      [from_email_address] =&gt; 2
      [receipt_text] =&gt; 
      [MAX_FILE_SIZE] =&gt; 1073741824
      [discountcode] =&gt; 
  )
  
  
  ott 04 15:43:46  [info] $this-&gt;_mode is not set
  
  ott 04 15:43:46  [info] $$params = Array
  (
      [tax_amount] =&gt; 0
      [total_amount] =&gt; 30.00
      [contact_id] =&gt; 798
      [status_id] =&gt; 
      [source] =&gt; 
      [is_override] =&gt; 0
      [status_override_end_date] =&gt; 
      [campaign_id] =&gt; 
      [custom] =&gt; Array
          (
          )
  
      [exclude_is_admin] =&gt; 1
      [contribution_recur_id] =&gt; 
      [payment_instrument_id] =&gt; 5
      [trxn_id] =&gt; 
      [contribution_status_id] =&gt; 1
      [check_number] =&gt; 
      [receive_date] =&gt; 2021-10-04 15:43:00
      [card_type_id] =&gt; 
      [pan_truncation] =&gt; 
      [financial_type_id] =&gt; 2
      [contribution_source] =&gt; Ordinario Iscrizione: Registrazione Offline (di Giorgio Mazzacurati)
      [lineItems] =&gt; Array
          (
              [2] =&gt; Array
                  (
                  )
  
          )
  
      [processPriceSet] =&gt; 1
  )
  </code></pre>
  <p>But doesn't see any membership_id, could you help to solve the problem and set this value?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-03T10:34:09.010Z
Comments.Text: We're seeing this issue too in 5.45 and WordPress 5.8.3. We use a Price Set for our Memberships, so maybe that is the issue. Can you clarify what action you took to resolve/get around this? Thanks!
Comments.UserDisplayName: Marcus J Wilson
Tags: <civimember>
Title: Again membership_id error in manual membership
ThreadText: # Again membership_id error in manual membership
  
  (Asked by: username_0 on 2021-10-04)
  
  After upgrading to 5.41.2 on Wordpress 5.8.1 I still have the problem with manual add a new member.
  
  ```
  ott 04 14:42:55  [error] 
  $Fatal Error Details = array:3 [
    "message" => "Mandatory key(s) missing from params array: membership_id"
    "code" => null
    "exception" => CiviCRM_API3_Exception {#29193
      -extraParams: array:6 [
        "fields" => array:1 [
          0 => "membership_id"
        ]
        "error_code" => "mandatory_missing"
        "entity" => "MembershipPayment"
        "action" => "create"
        "is_error" => 1
        "error_message" => "Mandatory key(s) missing from params array: membership_id"
      ]
      #message: "Mandatory key(s) missing from params array: membership_id"
      #code: 0
      #file: "/home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/api/api.php"
      #line: 134
      trace: {
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/api/api.php:134 {
          › if (is_array($result) && !empty($result['is_error'])) {
          ›   throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
          › }
        }
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php:2512 { …}
        /home/gragorg/staging.grag.org/wp-content/uploads/civicrm/custom_php/CRM/Member/Form/Membership.php:1324 { …}
        /home/gragorg/staging.grag.org/wp-content/uploads/civicrm/custom_php/CRM/Member/Form/Membership.php:881 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:526 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:152 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:119 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:352 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/Page/Tab.php:314 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Member/Page/Tab.php:384 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:313 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
        /home/gragorg/staging.grag.org/wp-content/plugins/civicrm/civicrm.php:1178 { …}
        /home/gragorg/staging.grag.org/wp-includes/class-wp-hook.php:292 { …}
        /home/gragorg/staging.grag.org/wp-includes/class-wp-hook.php:316 { …}
        /home/gragorg/staging.grag.org/wp-includes/plugin.php:484 { …}
        /home/gragorg/staging.grag.org/wp-admin/admin.php:259 { …}
      }
    }
  ]
  
  ```
  
  The custom php is not relevant: the problem is identical with original file (the custom is very simple and very localized)
  I do more investigation and for me it is strange is the variable is not set and the <https://lab.civicrm.org/dev/core/-/issues/2431> I understand that the problem is related to the form which pass the data. I have printed the values:
  
  ```
  ott 04 15:43:46  [info] $$this->_params = Array
  (
      [hidden_custom] => 1
      [hidden_custom_group_count] => Array
          (
              [] => 1
          )
  
      [qfKey] => CRMMemberFormMembership2dowfisuhgsgcs4wo0c4kw08occ0wswo0c0swcw00cc0kc8gkg_9712
      [entryURL] => https://staging.grag.org/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fmember%2Fadd&amp;page=CiviCRM&amp;reset=1&amp;action=add&amp;context=standalone
      [join_date] => 2021-10-04
      [start_date] => 
      [end_date] => 
      [price_set_id] => 
      [contact_id] => 798
      [max_related] => 
      [membership_type_id] => Array
          (
              [0] => 1
              [1] => 2
          )
  
      [num_terms] => 1
      [source] => 
      [campaign_id] => 
      [status_id] => 
      [is_override] => 
      [status_override_end_date] => 
      [record_contribution] => 1
      [total_amount] => 30,00
      [receive_date] => 2021-10-04 15:43:00
      [payment_instrument_id] => 5
      [trxn_id] => 
      [contribution_status_id] => 1
      [financial_type_id] => 2
      [soft_credit_type_id] => 
      [soft_credit_contact_id] => 
      [from_email_address] => 2
      [receipt_text] => 
      [MAX_FILE_SIZE] => 1073741824
      [discountcode] => 
  )
  
  ott 04 15:43:46  [info] $this->_mode is not set
  
  ott 04 15:43:46  [info] $$params = Array
  (
      [tax_amount] => 0
      [total_amount] => 30.00
      [contact_id] => 798
      [status_id] => 
      [source] => 
      [is_override] => 0
      [status_override_end_date] => 
      [campaign_id] => 
      [custom] => Array
          (
          )
  
      [exclude_is_admin] => 1
      [contribution_recur_id] => 
      [payment_instrument_id] => 5
      [trxn_id] => 
      [contribution_status_id] => 1
      [check_number] => 
      [receive_date] => 2021-10-04 15:43:00
      [card_type_id] => 
      [pan_truncation] => 
      [financial_type_id] => 2
      [contribution_source] => Ordinario Iscrizione: Registrazione Offline (di Giorgio Mazzacurati)
      [lineItems] => Array
          (
              [2] => Array
                  (
                  )
  
          )
  
      [processPriceSet] => 1
  )
  
  ```
  
  But doesn't see any membership\_id, could you help to solve the problem and set this value?
  
  **Tags:** civimember
  
  > **Comments:**
  > **username_1**: We're seeing this issue too in 5.45 and WordPress 5.8.3. We use a Price Set for our Memberships, so maybe that is the issue. Can you clarify what action you took to resolve/get around this? Thanks!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-10-05. Score: 0
  
  After a long debug analysis I understand that the problem is related to missing linenumber associated to the membership type. I solved saving every records with a price without . (Maybe it is enough to save)
  
  
  ---
  
  