Repository navigation
Forms learn to feed the newsletter - #41
Merged
Merged
Conversation
A form is where a relationship with a visitor starts; the newsletter is how it continues. With MailPoet installed, any form can now subscribe the visitors who opt in — and the bridge is a window of its own, one dock row below Themes. The window wears MailPoet's face where it introduces them — their logo, served from their own install, on the one hero surface allowed their orange — and the shell's tokens everywhere it works. Pick a form, tick the lists, map the email and name answers, and bind the subscription to a box the visitor actually ticks: consent is the default, "everyone who submits" is the deliberate choice, and MailPoet's own double opt-in confirms every address on top. Without MailPoet, the same window makes the case and points at the installer. What it writes is deliberately unexciting: an ordinary `mailpoet` action in the form's schema, conditional through the same logic block every action carries, run by the same pipeline, its failures recorded on the entry like any action's. The handler maps the answers, hands them to MailPoet's documented API, and treats "already subscribed" as the visitor asking for something that is already true — an outcome, not an error to stamp on their entry. Proven end to end against the real MailPoet: a front-end submission with the consent box ticked lands as an unconfirmed subscriber on the chosen list, with MailPoet's confirmation email on its way. The PHP side is covered by a recording stub that answers to the same API, so the suite proves the mapping, the consent gate and both already-subscribed fallbacks without MailPoet installed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
The api module gained the /mailpoet call, and every bundle that imports it re-emits with the change — CI's bundles-match-source check is precisely for the ones forgotten. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
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.
What
The MailPoet integration: a new MailPoet row in the dock submenu (below Themes) opens a dedicated window where any form can be connected to MailPoet lists.
The window
The plumbing
Deliberately unexciting: an ordinary
mailpoetaction in the form's schema — conditional through the same logic block every action carries, run byatf_run_actions(), failures recorded on the entry. The handler (includes/mailpoet.php) maps answers to MailPoet's documented API (addSubscriber→subscribeToListsfallback), treats "already subscribed" as an outcome rather than an error, and MailPoet's own double opt-in confirms every address.GET /atf/v1/mailpoetserves state + lists, capability-gated on editing forms.Verified
unconfirmed(double opt-in pending) on the chosen list.atf_run_actions()pipeline, both already-subscribed fallbacks, clean refusals, REST payload) against a recording stub that answers to the same API, so CI needs no MailPoet.tsc --noEmitclean, PHPCS clean.readme.txt gains the feature section — the kind of integration that is a paid addon elsewhere, free here.
🤖 Generated with Claude Code
https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp