Repository navigation
Conversation
Feature: admin-interface/settings-page/subscriber-gate-defaults Implements: - US-001: default gate headline and text with fallback on read - US-002: unlock cookie lifetime, whole days 1 to 365, else 30 - US-003: Publication and Subscriber gating saves keep each other's values The Subscriber gating section prints for every administrator, including when the Publication section is hidden. Options::get_gate_settings() returns final values for the gated content block.
Feature: custom-blocks/gated-content-block/gated-content-block Implements: - US-001: gated block with Subscribe form ID, Headline and Text - US-002: optional gate divider, valid only directly inside the gated block - US-003: server-rendered gate card over blurred, height-limited locked content - US-004: unlock in place when the block's own form is submitted - US-005: site-wide unlock cookie, logged-in bypass, first gate per page - US-006: locked content is inert and hidden from assistive technology The gate view script loads only on pages that render a gated block.
…ew blocks has_divider() re-iterated the shared inner block list from inside the loop over that same list, so the cursor reset and the loop never ended whenever two or more blocks came before the divider (or no divider was present).
…add theme fade variable
…ver faded content
…ted content block
…gated block, restore publication reset on save
…s link in the gated block sidebar
…ber gating settings
…ard" The form's alignment is set inside the beehiiv form itself, so the card CSS had no effect.
…rop heading level
…, reserve form space
…e form space until it loads
… runner to Ubuntu 24.04
…specs Options::sanitize() ignored the publication fields unless the section flag was present. WordPress runs the callback twice on the first save, when no option row exists, and the second run has no flag. The first save therefore stored a blank publication and template. Submitted fields are now always applied, and a shown section still clears missing ones. E2E specs now send the section flag as the real form does, expect the gate defaults and the gateFormId key, and no longer expect a required publication select. The gated-content spec makes sure a theme is active, because a tests site with a missing theme renders blank front-end pages.
The settings page left the post template select enabled when no publication was chosen, which did not match the PRD. It is now disabled on page load when there is no publication, and the settings script disables it again when the publication is cleared. A disabled field is not submitted, and the shown Publication section already saves a missing template as blank. The publication spec no longer expects this to fail and now checks the field both ways. One PHPUnit case used a lone paragraph as the nothing-to-gate example, but a block with no divider is fully gated. It now uses a divider with nothing after it.
Choosing a publication and then clearing it started two template loads. The first load finished last and re-enabled the post template dropdown with templates for a publication that was no longer selected. Each load now checks that it is still the newest one before it changes the page. Clearing the publication also resets the refresh button label.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds subscriber gating to the plugin (Teamwork task 19815117). Editors wrap content in a Gated Content block. Readers see a preview, then blurred locked content behind a subscribe card. Submitting the block's own beehiiv form unlocks the content in place and sets a site-wide cookie.
beehiiv/gated-content) holds inner blocks and renders on the server. The first inner block is the preview, or everything before an optional Gate Divider block. Per-block form ID, headline and text, plus card background and text colours.beehiiv/gated-content-divider) is allowed only directly inside a gated block.BEEHIIV_SUBSCRIBER_FORM_SUBMITTEDfromsubscribe-forms.beehiiv.com(and the legacy embed host) and unlocks only whenexternalEmbedIdmatches the block's form ID.Behavior worth knowing
Testing
tests/js/gated-content-view.test.js(6 tests) passes.GatedContentRenderTest,SubscriberGateDefaultsTest) and the Playwright e2e suite for this feature.Known gaps