Membership level upgrade attaches 2 levels

I have a membership site, and there are 2 levels, 1 free and 1 paid. One of the members upgraded from free to paid, but now they have both levels attached to their account, instead of the free level being removed and the paid level being added. I have it set so that no one can join multiple levels.

  • mediastead

    Thanks Ash,

    Just another little note ... in addition to the upgrade from FREE to PREMIUM causing the member to be in both membership levels, I am also unable to remove the free level from the user manually.

    To elaborate, when I tested the upgrade, my test resulted in the two membership levels being associated to my test user. Then, I went to "All Members" and tried to hit the "X" next to the free membership level to remove it from the user. The level disappeared, but when I refreshed it was back.

    Then, after testing all of this with chat support, another weird thing started happening where the paid premium level stopped being added completely. I tried to ugraded from free to premium, but I also tried singing up to premium directly. I completed the payment through my sandbox, and I was sent to the thank you page, however, the premium level was not added.

    When I checked, the invoice was created and put into the "drafts" section of billing as pending.

    I don't know if all of this has to do with the same bug, or different bugs. I switched my theme to the default twenty-seventeen, and all of the plugins except Membership are disabled.

    Thank you for looking into this.

  • Lindeni Mahlalela

    Hello mediastead

    I hope you are doing great today. I am really sorry that you are having issues with our Membership plugin and I hope we resolve it soon.

    I have tried to replicate this issue on my test site by creating a similar setup as yours with similar addons active as in your site then I tried to signup for the free membership (same settings as yours) then after that upgraded to a paid membership. Surprisingly, it worked perfectly and the transaction log looks like this:

    And I see this on the Members page:

    In the transaction history I have the following entry:

    October 16, 2017 Membership Free Lifetime Membership deactivated

    Which means the free membership was deactivated before the paid one was activated. I have also logged into your website and clicked the "X" on the free membership and it was removed, I loaded the page a couple times and the Free membership is completely removed from the user's account.

    This seems to be confusing and not clear what exactly happened during the upgrade performed by the user. It would be better if we had error/debug log to see what the real issue is. In such a case it would be better to have access to a staging site so that we can do all the testing required.

    I have looked into the debug.log file and found the following log entries:

    [10-Sep-2017 17:10:23 UTC] PHP Notice:  Trying to get property of non-object in /<content_dir>/plugins/membership/app/model/class-ms-model-relationship.php on line 2994
    [10-Sep-2017 17:10:23 UTC] PHP Notice:  Trying to get property of non-object in /<content_dir>/plugins/membership/app/model/class-ms-model-relationship.php on line 2998
    [10-Sep-2017 17:10:23 UTC] PHP Notice:  Trying to get property of non-object in /<content_dir>/plugins/membership/app/model/class-ms-model-relationship.php on line 3012
    [10-Sep-2017 17:10:23 UTC] PHP Notice:  Trying to get property of non-object in /<content_dir>/plugins/membership/app/model/class-ms-model-relationship.php on line 3016

    I checked the code on these lines and it seems to be related to the "Additional Automated Messages" addon, this should not have any interference on the upgrade process. This seems to have occurred on September 10 and the member signed up for the paid membership on October 10 so this debug notice does not seem to be the cause of the issue.

    If you want us to do further tests, please give support access to a staging site and give FTP and Database access to the staging site so we can try to replicate and troubleshoot. You can share login details via our secure contact form, on the contact page make the subject to be "Attn: Lindeni Mahlalela" then in the Message box include the following:

    - WordPress admin login to Staging/Test site (username and password)
    - FTP login details (host, port, username and password)
    - Link back to this thread for reference.

    You are not required to provide this if you don't need any further debugging/troubleshooting.

    I hope this helps. Please let us know if you need any further assistance with regards to this issue.

    Have a nice day.

  • Lindeni Mahlalela

    Hello mediastead

    I hope you are doing great. Thank you for your feedback and for the help in resolving this.

    I think I have found the issue here. The issue seems to be a configuration in the wp-config.php file that was intended for Membership 2 to lock memberships and subscriptions on cloned sites to avoid members receiving updates and notifications from staging site. The following line of code in the wp-config.php is the cause for this:

    define( "MS_LOCK_SUBSCRIPTIONS", true );

    When defined, this line tells membership 2 to lock all subscriptions so that they will not be changed during development. So, the function to deactivate a membership was blocked by this and was not able to deactivate the free membership.

    I am not sure who added this on your site, if it was one of the Staff members of WPMU DEV then please accept my sincerest apology on their behalf for any inconveniences that this have caused. Please do note however that you may still need to keep this active on your staging site but inactive on the live site.

    I have tested that removing that line, the upgrade process works smooth but I have to revert back to leave it effective because I am not sure if it is necessary or not. So, please remove the line of code temporarily and do some tests to see what happens. If you confirm that this is the cause as I have found it to be, then you should at least remove it on the live site once you are done with all tests and your site is live.

    There is also this line:

    define( "MS_STOP_EMAILS", true ); which stops emails from being sent out by Membership 2, these two options are most suitable for staging sites. This last seems to be sufficient in new testing environments where updates will not be pushed from staging to live. If you intend to push all data from staging to live then you should keep both effective.

    You can change these in wp-config.php file on your website which you can access via FTP. Please let us know if you need help doing this and we will do it for you.

    I hope this helps. Please let us know if there is anything else that we can help with or if you have any follow up queries with regards to this issue.

    Have a nice day.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.