[Membership 2 Pro] Users status not changing after the expiry date

Users status not changing after the expiry date with their membership. On the backend, it says that status is Expired (no access), but if the member logs it, they still have access to protected content and in their account page it shows that Status is active.

  • Kasia Swiderska
    • Support nomad

    Hello Michael,

    I'm sorry to hear that our plugin is not working correctly on your site.

    I've checked your site and it is strange that dates are showing expiration correctly but subscriptions are still active.
    Can you tell me if those memberships were assigned manually to those members by admin? I have a suspicion that this might be related, but I would need to test this scenario and see if I can replicate the same problem.
    Please let me know.

    kind regards,
    Kasia

    • Michael
      • WPMU DEV Initiate

      Hi Kasia,

      Yes the members were added manually. We were running the previous version of the membership plugin and when I was moving over the members the import failed on numerous attempts so each member was then added manually.

      Michael

  • Patrick Freitas
    • Staff

    Hi Michael

    Hope you are doing well.

    Thank you for the new information, I could find a related situation and applied a beta plugin on the staging site.

    After upgrading the plugin to the new beta, I went to All Users > Select the maud.++++@++++.fr user, and saved, it forced user update settings.

    Can you check you try to replicate and confirm if the problem is gone on the staging site?

    If so, please, update the thread with test results, and we can apply the same fix on the live site.

    Best Regards,
    Patrick Freitas

  • Michael
    • WPMU DEV Initiate

    Hi Patrick Freitas

    Thanks for the update, I tried this on another user and can confirm this has worked and the user was unable to access content after being updated.

    Does this mean that all users that should have expired will have to be updated manually or will this fix update the status automatically in the future?

    Thanks,
    Michael

  • Patrick Freitas
    • Staff

    Hi Michael

    I'm glad to hear that it worked.

    Can you try to move the member to expired status and check on next 6 hour and see if it will update the membership automatically?

    The check_membership_status runs every 6 hours.

    Also, if you would like to send me the live information and I can apply the same fix on the live site.

    Note: Don't leave your login details in this ticket.

    Instead, you can send us your details using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question:

    Subject: "Attn: Patrick Freitas"

    - Site login URL:

    - WordPress admin username:
    - WordPress admin password:

    - FTP/SFTP credentials

    Host:
    Username:
    Password:
    Port:

    - cPanel credentials

    Host:
    Username:
    Password:

    - Folder path to the site in question:

    - Link back to this thread for reference

    - Any other relevant URLs/info:

    Please, reply to the ticket once you have sent the information.
    Best Regards
    Patrick Freitas

    • Michael
      • WPMU DEV Initiate

      Hi Patrick Freitas ,

      I've got 2 members who have 'expired' I then ran the 'check status' and the users are still listed under expired but they still have the membership associated to their account.

      On the membership type it set so that once the membership ends the user is set to 'visitor-level' this is the part that is currently not happening.

      Kind regards,
      Michael

      • Patrick Freitas
        • Staff

        Hi Michael

        Hope you are doing well.

        Please, create a full Backup first of the live site.

        Log out from the wp-admin until the steps are complete.

        - Using the FTP, go to the WordPress installation > wp-content
        - Create a new Folder, you can call it plugin-bak
        - Go to wp-content > plugins
        - Move the membership-pro folder from plugins to plugin-back
        -Download the attached beta unzip and upload the membership-pro folder into the plugins folder.

        - When the upload is completed, you can log in back to the wp-admin

        Let us know if you need any further help on this.
        Best Regards,
        Patrick Freitas

        • Michael
          • WPMU DEV Initiate

          Hi Patrick Freitas,

          Thanks for that, just running through and noticed that in the dev site other expired users have not switched over to the 'expired' status. I've run the 'check status' again but i'm not seeing any new 'expired' members and there should be around 50 in the expired state on this setup.

          • Michael
            • WPMU DEV Initiate

            The following user ID's all should have expired status:

            742
            741
            740
            739
            738
            737
            736
            735
            734
            733
            732
            731
            730
            729
            728
            727
            726
            725
            723
            722
            721
            720
            719
            716
            715
            714
            713
            712
            711
            710
            709
            708
            707
            706
            705
            704
            702
            701
            700
            699
            698
            697
            696
            695
            693
            692
            687
            686
            684
            683
            682
            681
            680
            679
            677
            676

          • Patrick Freitas
            • Staff

            Hi Michael

            Thank you for the user IDs

            I checked some randomly IDs and can see they are working fine,

            ID 742

            ID 680

            ID 709

            However, I can see the Membership > All Members > Expired is not being updated it won't be a problem, the member will not have access, but I found a related issue, and we will be checking if this is the same.

            We will keep you posted.
            Best Regards,
            Patrick Freitas

  • Kasia Swiderska
    • Support nomad

    Hello Michael,

    I have escalated this to our Second Line Support Developers to check. My suspicion is that manually editing dates might interfere with how the Expired subscription behaves, however, I would need confirmation (or not) from developers.
    They let us know about the results.

    kind regards,
    Kasia

  • Panos
    • SLS

    Hi Michael and Stuart :slight_smile:

    Do you mean the subscriptions listed in this screen:
    yousite.com/wp-admin/admin.php?page=membership2-members&status=expired

    In that screen it should list the subscription information and the membership is part of the subscription. Since the subscription is not active the user will not have membership access. The member has an expired subscription which he can re-new in the future too!

    So there is no reason to remove the membership from that list, if we do it will be a list of users and not subscriptions. It also gives you the information which membership did a member have.

    Hope I explained my point here!

    Kind regards!

  • Michael
    • WPMU DEV Initiate

    Hi Panos,

    Yes it is that page. I understand what you mean by this but it seems strange not to honour the settings of the membership where it states 'restrict access to the visitor level'.

    I agree that it would be useful to see what membership the user was on (which you can through the history and log) but I don't think its clear when you look at a user you can't see the status of their membership.

    If you look at the below image, when you see the 'visitor' status you know a user will not have access but when you look at the other members there is no difference to the membership.


    I would suggest the status needs to honour the settings and apply the 'visitor' tag as described to avoid confusion. Unless it was spotted users would have continued to gain access to content that was no longer part their subscription. This could result in a loss of revenue as there would be no need to subscribe.

  • Panos
    • SLS

    Thanks for your feedback Michael !

    it seems strange not to honour the settings of the membership where it states 'restrict access to the visitor level'

    The "Visitor level" is granted to member when he has no active subscription. It can be considered as a state of a user, not a Membership. It states that member with "Visitor-Level" access, has no access to any level provided by Subscription Rules.

    The whole point is to list expired Subscriptions in that tab, not the access level. As I explained, a Subscription is a combination of a Membership and a Member. If there is Member id missing or a Membership id missing you can not have a Subscription object.

    In the screenshot you shared with the Visitor level, this is shown temporarily as there is no Membership, so no Subscription. The developers decided to show the access level there instead of removing it instantly, in case the admin wants to add some other Membership there. Once you refresh that page, that subscription will not be listed there anymore.

    Kind regards!

  • Panos
    • SLS

    Hi Michael !

    I totally understood something much different when reading this thread. Apologies for that.

    Regarding https://premium.wpmudev.org/forums/topic/membership-2-pro-users-status-not-changing-after-the-expiry-date#post-1390507

    could you please confirm that you have taken a backup so I could install this mu-plugin
    https://gist.github.com/wpmudev-sls/351aaa686d6ce8f8b3fd35f9ac8418e1
    on your site? This should set those members to proper status in db. If I leave this mu-plugin on your site it should set the status to Expired no similar cases. However it is not well tested so I'll remove it after done. I have informed the developer so we will have a fix for this.

    Kind regards!

  • Panos
    • SLS

    Thanks for the confirmation Michael !

    I ran the mu-plugin and they should all be expired now. Please have a look and let us know if you notice anyone that still has access. In order to make that check easier I have added a mu-plugin that creates a new page here :
    yoursite.com/wp-admin/admin.php?page=ms-db-status-monitor
    where it lists all expired subscriptions. If it is still marked as Active in db, it should have a red background. Additionally it adds a new field in the Member's page ( wp-admin > Membership 2 > All Members and click on a member ) labeled as DB Status and contains the status set in db for that subscription.

    Kind regards!

  • Panos
    • SLS

    Hi Michael ,

    I deleted the mu-plugin form your site since it interferes a lot with the cron job the checks the statuses. It is OK for it to run in a cron where we only need to expire that status, but I am unsure how it would affect if it is ran on all cron jobs. I need to do some improvements and more tests on it so I can leave it active on a live site, until this is patched in plugin.

    For now I have ran it so those 3 members should be expired. I removed it again though. I'll keep you updated when this will be tested on all cron jobs :slight_smile:

    Kind regards!

  • Michael
    • WPMU DEV Initiate

    Hi Panos & Patrick Freitas,

    Thanks for the updates, I've been doing some more tests and I think the issue might be related to the date of the expiry date being changed. I added myself to one of our subscriptions (default is 1 year) I changed this to expire after 1 day and the status does show expired in the subscription details but not on the list of expired members.

    I've created a 1 day subscription which I'm testing now to see if it works as expected and that after the subscription is over it turns to expired with no access and also appears in the expired members section.

    I'll await updates about the cron.

    Michael

  • Panos
    • SLS

    Hi Michael !

    This is because I still haven't added the mu-plugin on your site. I have added it now on your site now.

    Changes on your site are:
    1. Uploaded this mu-plugin file : /wp-content/mu-plugins/ms-override-cron-check.php
    2. On file /wp-content/plugins/membership-pro/app/model/class-ms-model-relationship.php I have added the following filter hook in the check_membership_status method :

    if ( apply_filters( 'ms_model_relationship_skip_membership_status_check', false, $this ) ) {
    			return;
    		}

    This is the same process I did in the previous tests on your site. However,since I have done a few modifications and tests I will leave it like this from now on so it should expire those subscriptions on db too. Le me just tell you that I have modified that plugin so that it will ignore all cases where the date is not expired, so it shouldn't affect other subscriptions than the ones that should be expired.

    I have done several tests and didn't notice anything wrong. However please keep an eye and let us know if you notice anything.

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.