0

When I try to add a membership from the back office as an admin on CiviCRM 5.42.1 on WP 5.5.6, I'm getting this error 500 I don't know how to interpret.

Where could I dig in?

EDIT 1: Trying through API V3 worked like a charm, is this a front end issue (js / AJAX)?

***ERROR***
message:            invalid criteria for IN
code:                
exception:          CiviCRM_API3_Exception Object
(
[extraParams:CiviCRM_API3_Exception:private] => Array
    (
        [is_error] => 1
        [error_message] => invalid criteria for IN
        [error_code] => undefined
    )

[message:protected] => invalid criteria for IN
[string:Exception:private] => 
[code:protected] => 0
[file:protected] => /home/domain/domain/wp-content/plugins/civicrm/civicrm/api/api.php
[line:protected] => 134
[trace:Exception:private] => Array
    (
        [0] => Array
            (
                [file] => /home/domain/domain/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Membership.php
                [line] => 1834
                [function] => civicrm_api3
                [args] => Array
                    (
                        [0] => Membership
                        [1] => get
                        [2] => Array
                            (
                                [id] => Array
                                    (
                                        [IN] => Array
                                            (
                                            )

                                    )

                                [version] => 3
                            )

                    )

            )

        [1] => Array
            (
                [file] => /home/domain/domain/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Membership.php
                [line] => 1523
                [function] => getCreatedMemberships
                [class] => CRM_Member_Form_Membership
                [type] => ->
                [args] => Array
                    (
                    )

            )

        [2] => Array
            (
                [file] => /home/domain/domain/wp-content/plugins/civicr...
2

The top (0) entry of your trace says that it's trying to run an civicrm api command without enough arguments. It's trying to get memberships matching some collection of ids, but the code isn't providing anything to match.

The next entry shows you how it go there - it's trying to get the memberships that it has just created.

My guess is that the error is actually happening earlier than this trace shows - i.e. a membership is not getting created, but the code is then trying to work with whatever membership it assumes has been created, and is failing.

There are a few issues here:

  1. Figuring out why the membership wasn't created - likely there is an earlier warning in the error log. It might be related to a core error or an extension error, or even a WP-Civi integration issue.

  2. Figuring out why the code kept going after it failed earlier. That's for bonus points.

1
  • thanks Alan, I'm starting to have a better overview of this strange issue Nov 4 '21 at 10:50
1

Recreating the equivalent memberships and then updating them with SQL was the solution

UPDATE `contact_membership` SET `membership.id` = 'Y' WHERE `membership.id` = 'X'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.