Skip to content

feat: new option to require all membership plans for restricted content#2623

Merged
dkoo merged 2 commits into
masterfrom
feat/overlapping-membership-plans
Sep 1, 2023
Merged

feat: new option to require all membership plans for restricted content#2623
dkoo merged 2 commits into
masterfrom
feat/overlapping-membership-plans

Conversation

@dkoo

@dkoo dkoo commented Aug 31, 2023

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

Some publishers want to gate most articles behind a metered reg wall, but gate some smaller subset of those articles (e.g. those with a "Premium" category) behind a hard paywall. Free registrants should get access to most articles, but not to paywalled articles until they purchase the necessary membership. This is a common content gating strategy used by many large-scale publishing sites but which we currently can't support without the proposed change.

We do have the ability to show different paywalls for these two "tiers" of restricted content. This is done by creating two membership plans: Plan 1 restricts all posts with a metered reg wall. Plan 2 restricts Premium articles with a paywall.

However, the way WooCommerce Memberships works, if multiple different membership plans have different rules restricting the same content (as in the above example—Premium articles are a subset of all articles) it will grant access to the restricted content as long as the reader is a member of ANY applicable membership plan. So this defeats the purpose of the paywall in the above scenario: as soon as you register a free account, you get access to all articles, which includes the Premium articles.

This PR introduces a new option in the Reader Activation wizard where we already show other Content Gate settings. This option lets us implement a "stricter" evaluation of membership rules when deciding whether or not to grant access to restricted content.

Screenshot 2023-08-31 at 2 03 31 PM

The default (disabled) behavior introduces no changes to the current behavior, as some publishers have content gating strategies that require this behavior. When enabled, the behavior changes such that if multiple membership plans are restricting access to the same content, a reader must be a member of ALL plans in order to get access to the content, not just one of them.

Closes 1200550061930446/1205368936341187.

How to test the changes in this Pull Request:

  1. On master, set up two membership plans.
  • Plan 1: Should grant access upon "user account registration" and should restrict access to all posts of post type "Post".
  • Plan 2: Should grant access upon product "product(s) purchase", tied to a paid subscription product, and should restrict access to a specific category or categories of posts.
  1. Go to Newspack > Engagement > Reader Activation and open the advanced settings panel. Edit and publish your primary content gate and insert a Registration wall pattern. Turn on metering and set it to an easily testable value like 2.
  2. From the WooCommerce Memberships sidebar panel in this editor, create or edit the content gate tied to the subscription-based Plan 2 above. Add a paywall pattern tied to the subscription product with no metering and publish.
  3. On the front-end, start a new reader session and immediately visit a post in the premium category. Confirm that the post is blocked by the paywall gate right away.
  4. Visit 3 other non-premium posts. Confirm that you're able to see the first two, but that the third is blocked with the reg wall gate.
  5. Register for a free account from the reg wall and confirm that you gain access as expected.
  6. Visit any premium post and observe that you also now have access to these posts, despite not owning the required subscription/membership.
  7. Check out this branch and go back to Newspack > Engagement > Reader Activation. Confirm you see the new option right under the content gate and that it's off by default (note that you will only see the new option if your site has more than one active membership plan):
Screenshot 2023-08-31 at 2 03 31 PM
  1. Leave it off and do a smoke test by repeating steps 4–7. The behavior should be exactly the same as before.
  2. Toggle on the new option and save. Refresh the admin page and confirm your setting persists.
  3. Repeat steps 4–7 again, but this time confirm that at step 7 after registering for a free account, you have access to non-premium posts while premium posts are still blocked by the paywall gate.
  4. Purchase a subscription product via the paywall gate and confirm that you now have access to all premium posts as well.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Aug 31, 2023
@dkoo dkoo requested a review from miguelpeixe August 31, 2023 23:33
@dkoo dkoo requested a review from a team as a code owner August 31, 2023 23:33
@dkoo dkoo self-assigned this Aug 31, 2023
@dkoo dkoo changed the title Feat/overlapping membership plans feat: new option to require all membership plans for restricted content Aug 31, 2023

@miguelpeixe miguelpeixe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working great! 🙌

@github-actions github-actions Bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Sep 1, 2023
@dkoo dkoo merged commit 60b361e into master Sep 1, 2023
@dkoo dkoo deleted the feat/overlapping-membership-plans branch September 1, 2023 15:25
matticbot pushed a commit that referenced this pull request Sep 6, 2023
# [2.6.0-alpha.1](v2.5.1...v2.6.0-alpha.1) (2023-09-06)

### Features

* add anonymized email to ga4 events ([#2585](#2585)) ([9ac1c33](9ac1c33))
* add filter to the lists in the reg block ([#2611](#2611)) ([d960541](d960541))
* new option to require all membership plans for restricted content ([#2623](#2623)) ([60b361e](60b361e))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.6.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Sep 13, 2023
# [2.6.0](v2.5.1...v2.6.0) (2023-09-13)

### Bug Fixes

* sync scripts for Stripe-to-Woo migrations ([#2632](#2632)) ([34beb15](34beb15))

### Features

* add anonymized email to ga4 events ([#2585](#2585)) ([9ac1c33](9ac1c33))
* add filter to the lists in the reg block ([#2611](#2611)) ([d960541](d960541))
* new option to require all membership plans for restricted content ([#2623](#2623)) ([60b361e](60b361e))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants