Updated Protected content and every member account reset to visitor?

I Updated Protected content and every member account reset to visitor? How do I fix this? Every member has been sent an email saying memberships expired and now they are set as visitors. This is ridiculous!!

  • Ivan

    Hey Ryan,

    Sorry to hear you are having problems with protected content.

    Also I can see you are using the previous version - did you downgraded after that problem, or it was the update to 1.0.4.9 that reset the members levels?

    I have tested this on a live site I had with the previous version and existing memebers with assigned levels, and wasn't able to reproduce it. My colleague run another test and wasn't able to reproduce it too.

    How many members do you have?

    Do you use tiered membership?

    If you have any more information that you think might be useful, please share it.

    Can you please enable support access so we could take a look?
    You can see how to do this here.

    Cheers,
    Ivan

  • ryan

    I have added all users back to membership levels, however I can not protect posts. I add a post to a membership level and when i refresh it reverts back. This happens through the protect content option in the dashboard and if i try to protect the through the edit post section. Only happening for posts, pages protect fine, as well as menu items. Can I please get a response ASAP. My site is down until this is fixed for obvious reasons

  • Philipp Stracker

    Hi Ryan,

    sorry to hear that the update went wrong for you. This is nothing we take lightly - we have tested every scenario we could think of. And we'll do our best to get your site up and running again!

    First: I strongly suggest that you create a DB backup before doing anything else. Just in case ...

    Second: We have found instances where data is lost when DOWNGRADING from 1.1.0 to 1.0.4.9 - so even if you have troubles I ask you to stick with 1.1.0 and not downgrade. It will very likely make things worse again. We are already busy to find a solution for this!

    Finally the good news: I have prepared an SQL command that you can run in phpMyAdmin or any other SQL management UI. This command will set all subscriptions back to "Active", so all your members are signed up again!

    UPDATE wp_postmeta
    SET meta_value = 'active'
    WHERE
    	meta_key = 'status'  AND meta_value = 'deactivated'
    	AND EXISTS (SELECT 1 FROM wp_posts WHERE ID=post_id AND post_type='ms_relationship')
    ;

    This command activates all subscriptions that are stored in the DB - since you only have permanent-access memberships this state should be the correct one.

    If you want us to help you restore the protection rules please let us know here - we *may* be able to recreate the rules from the database entries, but it might take a while for us to come up with a script for you...

    Thanks for your quick responses and sorry again for all the chaos! We're working on the downgrade-issue now. Please let us know when we can help you with anything to restore your websites functionality...
    Philipp

  • Philipp Stracker

    I cannot explain what's going on here, but it is nothing I can reproduce locally...
    Do you have any testing/staging installation where we can observe these issues?

    I've added some additional logging and information on subscription-status to Protected Content that I'd like to upload on your site. When doing this it might happen again that all Subscriptions are lost, as I could not find or fix the reason for that issue. Before doing this I'd like to get your confirmation that it's okay for us to do this on the live site.

    As a first measure I have disabled the Coupons Add-on on your site. I tested the Coupons on my server and the coupon code was optional in all cases. Again - a staging/test installation where we can observe and reproduce the issue would help us very much!

    A personal suggestion to temorarily improve the current situation for your users:
    I noticed you're using Snapshot to backup your site. So you could actually restore a snapshot of the 1.0.4.9 version and downgrade the plugin. Did you try this already? After all this is what we keep backups for: In case something unexpected goes wrong.

    I'm just downloading a snapshot archive from your site and will try to reproduce the issues you experience using the backup data (of course I'll delete the files once I'm done). I'll keep you updated when I have found anything!

  • Philipp Stracker

    Hm. The "wp_m_" tables were used by the old "Memberships" plugin.
    Since you do not have the Memberships plugin installed those tables are not used anymore.

    But this points out that you had Memberships installed before using Protected Content. Maybe this helps us to find the issue!

    If you have access to phpMyAdmin or another MySQL management tool you could manually generate a DB-Export and then drop all wp_m_ tables, to get snapshot working again in future backups.

    When protection is not working after restoring a snapshot it *might* be caused by missing Permalink rules. This can be solved easily by deactivating + reactivating the Protected Content plugin.

  • Philipp Stracker

    Ryan, I have spent the whole day trying to figure out what's going on with your site. I was using the DB snapshot that I downloaded yesterday.
    On the very first test I could reproduce the issue on my local server! However, as many different possibilities I tested, the issue did not happen again for me.

    Also there were a few warnings about duplicate Primary keys when I was importing the snapshot for wp_postmeta. It may be that this is causing the problems. I see that your site is a few years old and that you used/tested various different Membership Plugins already. Currently it looks like either the DB structure is not up to date or some values in the postmeta table are causing these issues.

    I have updated Protected Content to version 1.1.0.3 on your site.

    Logging
    Now every time a subscription is deactivated you will find an entry in the file /wp-contents/lib2.log
    Check that file to get a full list of all deactivated memberships.

    Possible Solution
    Can you please test out the following steps on your site - they did resolve the issue on my local site:
    1. First use phpMyAdmin and make a Backup only of the tables "wp_posts" and "wp_postmeta".
    All subscriptions are stored in these tables, so if you revert only those two tables all Subscriptions will be restored.
    2. Go to Protected Content > Settings. Below the settings box you see a line that says "Check Membership Status in ..." Click that link (the first one) and the plugin will most likely deactivate all memberships again. This is what happened to me on the very first time I tested with your DB snapshot. (You can check the lib2.log file, there is a list with all deactivated memberships)
    3. Now go to phpMyAdmin again and rename or delete the table "wp_posts" and "wp_postmeta". Import the backup from step 1 again and check your Members list: The subscriptions are restored.
    If you repeat step 2 again the Subscriptions should still be there.

    Please let us know if this worked or if the subscriptions still get deactivated even after you re-create the tables. Important: In step 3 it's important that you delete or rename the tables, so that the table structure is created again!

  • ryan

    They still get deactivated even after re-creating the tables. and checkout still doesn't work. I even tried deleting those tables, then removing the plugin, re installing it, then importing the tables again, that didn't work either, also I don't see the log file that you said was added when i look through the WP-Content Folder. I just know instantly when i perform step 2 all memberships begin dropping from users

  • ryan

    I was also able to get a full snapshot tonight. So if you want to pull that one that's fine. I extended access as well. Also i Tried deleting the plugin, the DB tables, and installing the last version, then creating the tables again, members had memberships assigned, but memberships themselves were not there, so doing it that way didn't work either. I love the new interface, however, If we can't figure this out soon I am going to have to go to another plug-in and cancel this membership. The fact that we can't revert makes this much more of an issue

  • ryan

    Now, just to add to problems, when i try to test purchasing memberships, the product pages i created for each specific membership now take you to the list of all memberships, so that doesn't work anymore, as well as coupons are just flat broken, members being deactivated, AND on top of that, when you click sign up on any membership, it goes to invoice page that lists a random member of my website at the top of it. Guys this is ridiculous, PLEASE just help me revert back or something.

  • Philipp Stracker

    Hi Ryan,

    We're still investigating the unexpected membership status change issue that we started out in this thread. Though until now there's nothing new to report here...

    About the other issues you just mention in the last post: I did observe some on your site but neither me not my coworkers were able to reproduce them on our own sites.

    It's good to know which issues are happening, but concluding on the current details in this thread I'm hoping that we can get some more constructive feedbacks to solve any existing issues.
    For instance - which of these have you tried, and what was the result:
    A) Set up a fresh WordPress site and test out Coupons, Signup, etc.
    B) Set up a Test site, import the data from your live site and check if things are broken there.
    C) Disable all plugins and switch to the default WordPress theme.

    Open issues:
    1. Coupons are broken: What exactly?
    2. Test Membership is doing crazy stuff - again, what exactly?
    3. Purchase Site leads to the membership list instead of payment site -> can possibly be solved by using the shortcode we provide [ms-membership-buy id="123"] instead of specifying the URL
    4. Signing up for a membership displays a random invoice title -> I can observe it on your site but nowhere else. I'd try to use the default theme and disable plugins (starting with the login-redirect / page-links-to / maintenance mode plugins) Also installing a debugging plugin such as "Query Monitor" or "Monkeyman Rewrite Analyzer" will likely help to shed light into this.

    We would not release a plugin if it contained so many obvious errors - quality control is an important step in our release process. This is why I'm suspecting some incompatibility with other plugins or settings. We could already rule out DB problems since you re-created the database and problems persist. Next step would be to try out the three steps I suggested in the top (new installation, create a second testing installation, deactivate plugins)

    I don't mean to provoke you with that rather "harsh" message but 'm trying to direct this thread in a more productive direction. Also I'm very thankful that you kept a respectful tone despite the circumstances! Thanks for that :slight_smile:

    Hope that my feedback and the sumary helps you to fix some of the existing issues and give us some more details on the remaining ones. Philipp

    Off-Topic Suggestion:
    As I'm also runing a WordPress business site I know that this is a very delicate situation. A suggestion from me would be: Get a DB backup, then reset the Protected Content plugin (visit the URL "/wp-admin/admin.php?page=protected-content-settings&reset=1"). Set up your memberships again. Then send all your members an email saying sorry for all the mess and offering them a coupon to sign up and get access to some new content for 14 days (use a Finite Payment-Type membership set up for 14 days). Before you reset the plugin please test out if Coupons, etc are working on a new test-site that you create on the same server. This can be done in 4-6 hours and you'd have your site up and running again.

  • Philipp Stracker

    Hey guys, as a first measure we have just released an update for Protected Content that includes two new "plugin modifiers":

    Add them in your wp-config.php file to bypass the membership issue until we have found a permanent fix.

    // Memberships will not expire anymore. No automatic status check is made by Protected Content.
    define( 'MS_LOCK_SUBSCRIPTIONS', true );
    // Protected Content will not send any emails while this modifier is active.
    define( 'MS_STOP_EMAILS', true );

    Using the first one (Lock Subscriptions) should do the trick for you: Members can register and cancel their memberships. Apart from this Protected Content will not change anything.
    I would not use the second option (Stop Emails) unless really needed, because it will also prevent the "Signup Completed" emails when new users subscribe.

    I hope this temporary change helps you to get that situation under controll again.
    Keep us updated if there is anything else - I'll post again when I know more about that issue you are having!

    Ryan:
    Exactly! You can Export the data, then reset the plugin data (using the &reset=1 URL I mentioned before) and import the data. You only need to set up the rules again after the import but you'd have a clean Database. Just test it out on a fresh installation if you want to see how it works :wink:
    Tipp: Just to be sure, I recommend to enable both modifiers that we just added while you import and test things, so your members will not get any notifications.

  • Philipp Stracker

    Hi Lorenz, please add the following line to your wp-config.php file to temporarily solve the issue:

    define( 'MS_LOCK_SUBSCRIPTIONS', true );

    This will work once you updated to 1.1.0.5 (see my post above)
    p.s. I've just had a look at your site and can at least confirm it's exact same issue as Ryan has. The line above will fix the issue for you until we can provide a permanent solution.

  • Philipp Stracker

    Lorenz, I just tested the following and it seems that it will solve your issues - it will also work for you Ryan:

    1. Start by getting a DB Backup, just in case something goes wrong
    2. Export your Site data, using the Tools > Export. Export all the items, except the top 2 ones (Posts/Pages) - see the attached screenshot. You will have 5-6 export files (depending if you did use the Coupons Add-on or not)
    3. set MS_STOP_EMAILS and MS_LOCK_SUBSCRIPTIONS to true in wp-config.php
    4. Reset the Protected Content Data by visiting the URL "/wp-admin/admin.php?page=protected-content-settings&reset=1"
    5. You will see the Setup-Wizard again after the reset. Simply create a "Guests" Membership to complete the setup.
    6. Activate the Add-ons you used, esp. the "Coupons" Add-on if you had it before
    7. Go to Tools > Import > WordPress and import the previously exported files. This will restore all Memberships, Subscriptions and Invoices you had before.
    8. You'll have to set up the Payment Gateways again, so check the options in Protected Content > Settings > Payment
    9. Now remove "MS_LOCK_SUBSCRIPTIONS" from wp-config.php (but leave the other one)
    10. Visit the Protected Content > Settings page. In the bottom click the link "Check Membership Status Change..." - this function did deactivate your Subscriptions before and now it should not deactivate them anymore! So check your Members-Page
    11. If all Subscriptions are still there then Congratulations, the plugin finally is working as it's expected to! :slight_smile:
    If all your Subscriptions are still deactivated then please add the LOCK SUBSCRIPTIONS modifier to wp-config and repeat steps 4-8 to restore and lock them for now...

    I hope the description is clear :wink: Philipp

  • ryan

    Also, even after resetting the plug-in coupons still have issues. If you set a coupon to make a membership free, either by percentage or dollar amount, it changes price to $0 but it doesn't grant access after they register. Also, if you set a max use of a coupon, it gives the error of max uses reached, even if it has never been used before. And why does it continue to remake new subscription pages (account, register, etc) this caused problems earlier in the plugin and is causing me a headache again!

  • Philipp Stracker

    Hi Ryan,

    thanks for the feedbacks! I have still not been able to reproduce this issue in our installations consistently (it happened a single time but Protected Content fixed the data so it did not happen again)

    Can you send us an email using the Contact Form ("I have a different question") and send us
    - Either login details to your mysql database, e.g. for phpMyAdmin
    - Or a download link to a full DB backup of your site (e.g. hosted on Dropbox)

    When you send us the login details we will take a full backup ourselfs and once we found the issue we will fix it on your DB (of course we will take a full Backup right before making any changes and also document every query we execute so you can review the changes later)

    Btw: New subscription pages are created only when the settings are empty; usually this happens only once, when you create the first membership. When subscription pages are re-created it means that some settings have been lost or were not saved correctly... Can you check the PHP error.log file on that server?
    Also: Which PHP version are you using?

  • g33kdam0n

    Attn: Philipp Stracker
    https://premium.wpmudev.org/forums/topic/updated-protected-content-and-every-member-account-reset-to-visitor#post-836845

    I have a question: In a FRESH install would the protected content plugin work without issues?
    Meaning is this an update problem or a general problem? I wonder because others should have the same issues than we have.
    I considering making the page new - it is possible in my situation.

  • Philipp Stracker

    Hi @ryan (first post) -> I have just responded to you via Email

    @Ryan (second post) wow, you really confused me at first because of the name :wink:
    Can you give it a try again, I just tested the Subscriptions on your website and the subscriptions were not lost during status check. I assigned Memberships to your user "test99" and also created a new user "wpmudev" and registered for the free Membership. It looks like it's working for me...

    However: Since your plugin setup is still very small (very few Rules, only free Memberships) it will possibly be the fastest option to reset the plugin and set up the Membership again instead of hunting for junkdata created during the upgrade.
    I noticed that you downgraded the plugin at least once since updating it to 1.1.0.5. It is possible that this downgrade caused the issues...

    If you continue to experience the issue after the reset please open a new thread for it.

    About the Add-on:
    I saw that you created a custom Add-on that you use on your site (Registration whitelist)! Impressive :slight_smile:
    When the files are inside the plugins/protected-content folder then they will be removed on every update, that's just the way WordPress handles updates (first delete the old version then install the new version). Make sure the Add-on is stored in another directory, it's best to include it as an individual plugin.

    We quite like that Add-on idea! If you are okay with it you can send us an email with the files so we can review and integrate them into Protected Content!

  • Philipp Stracker

    Guys, we finally found something!!

    After digging for ages in the code we found that the date comparison uses UTC timezone in some cases and the local time in another case.
    So we were not able to reproduce the issue, because out local time is ahead of UTC, while yours is behind UTC! We'll release a fix for that timezone issue today or tomorrow!

    So hold your horses until the next update (1.1.0.8) is out, it will very likely solve the problems you're experiencing

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.