Automattic / newspack-plugin

An advanced open-source publishing and revenue-generating platform for news organizations.
https://newspack.com
GNU General Public License v2.0
325 stars 49 forks source link

Auto-disable ESP sync on staging sites and clone sites #3192

Closed claudiulodro closed 3 months ago

claudiulodro commented 3 months ago

All Submissions:

Changes proposed in this Pull Request:

Fixes an issue we run into occasionally where a clone/staging site will pollute live ESP data because there are multiple sites connected to the same ESP and syncing data.

Note: This is a hotfix.

How to test the changes in this Pull Request:

  1. Unit tests should prove the case for newspackstaging.com sites, but you can also actually test on one of those sites.

Locally:

  1. get option wc_subscriptions_siteurl should return something like http://newspack_[wc_subscriptions_siteurl]_dev.local (with your local site URL and that thing in the middle of it). Update it to some other URL (keep the thing in the middle of it). This will automatically put WC Subscriptions into staging mode.
  2. Before applying this patch, update the status of a subscription. Observe the status change IS reflected in the NP_Membership Status data synced up to the ESP.
  3. Apply the patch, update the status of a subscription. Observe the status change is NOT reflected in the data synced up to the ESP.
  4. Add define( 'NEWSPACK_FORCE_ALLOW_ESP_SYNC', true ); to your wp-config. Update a subscription status again and observe the change IS reflected at the ESP.

Other information:

claudiulodro commented 3 months ago

Thanks for the quick review! I'll merge this Sunday night or something so there's no risk of a Friday afternoon deploy :)

matticbot commented 3 months ago

:tada: This PR is included in version 4.3.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: