Skip to content

JOIN-147 Let a membership plan redirect to a page instead of taking payment - #124

Merged
conatus merged 19 commits into
masterfrom
feature/membership-plan-redirect
Oct 1, 2026
Merged

conatus merged 19 commits into
masterfrom
feature/membership-plan-redirect

Conversation

@conatus

@conatus conatus commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

What

A membership plan can now send people to a chosen page instead of taking payment.

  • Each plan has a new Redirect to a page instead of taking payment checkbox. Ticking it reveals a page picker.
  • The setting lives on the shared plan field, so it works in the global plans on the Join settings page and in a CK Join Form block's own plans.
  • When someone chooses a marked plan and continues, they go straight to the chosen page. There is no donation step, no payment and no join request. Their saved form progress is cleared, so coming back starts afresh.
  • Every other plan works exactly as before. A plan with the box ticked but no page chosen, or whose page has since been deleted or unpublished, takes payment as normal.
  • The continue button for a redirecting plan says "Continue" rather than "Continue and pay £X".
  • The setting is ignored in Donation Supporter Mode, which has no plan step.

Nothing is recorded for these people beyond the existing drop-off capture after the details step. They are not created in any CRM.

Why

Some organisations have a tier (for example students or a particular group) whose members should be handled outside the paid join flow, on a page the organisation chooses.

How

  • Settings::createMembershipPlansField adds the checkbox and page picker. The picker only shows once the box is ticked.
  • Settings::getMembershipPlanRedirectUrl turns a plan's settings into a URL, or null. It only returns a URL for a published page, because get_page_link() on a missing page falls back to the page being viewed, which would send people back to the join form.
  • The checkbox's help text names the CRMs the site uses (Action Network, Mailchimp, Zetkin), so admins can see where these people will not appear. Settings can only be read once the settings container is registered, so the text is filled in at that point.
  • Blocks.php passes it to the join form as each plan's redirectUrl.
  • app.tsx checks it at the plan step, using getPlanRedirectUrl and a new redirectToPage helper. redirectToSuccess now reuses that helper.
  • Version bumped to 1.4.43.

Tests

  • PHP unit tests for getMembershipPlanRedirectUrl: ticked with a page, not ticked, unticked but a page still stored, ticked with no page.
  • Jest tests for getPlanRedirectUrl and redirectToPage.
  • E2E, front end (plan-redirect.spec.ts): only the right plan gets a redirect URL; the redirect lands on the page without a join request; coming back starts afresh; the other three plan kinds go on to payment; Supporter Mode is unaffected.
  • E2E, wp-admin (admin-plan-redirect.spec.ts):
    • The help text names the CRMs switched on, on the settings page and in the block editor.
    • On the settings page: configure global plans through the real UI, confirm the picker shows and hides with the checkbox, save, reload, then check the redirect on a join form with no plans of its own.
    • In the block editor: build a plan in the CK Join Form block, publish, and check the redirect on the published page.
  • The seeded plans use the exact data shape the block editor saves, which the block editor test confirms.
  • Breaking the front-end redirect, or the PHP URL lookup, makes the relevant e2e tests fail.
  • The whole e2e suite passes locally from a fresh database (77 tests), and the new specs passed three repeated runs.

E2E setup changes:

  • The seed now stops WordPress's admin email check screen from appearing.
  • There's a loginAsAdmin helper.
  • The settings test re-runs the seed afterwards, because saving the settings page rewrites the global settings the seed sets directly.

Test plan

  • Join settings > Membership Plans: tick the new box on a plan and check the page picker appears; untick it and check the picker hides
  • Choose a page, save, reload, and check the plan still has the box ticked and the page chosen
  • In a CK Join Form block's custom plans, repeat the two checks above and update the page
  • On the front end, choose the marked plan and continue: you land on the chosen page with no payment step
  • Choose any other plan: the donation and payment steps work as before
  • Tick the box without choosing a page: that plan takes payment as normal
  • Choose a page, then trash it: that plan takes payment as normal
  • Selecting the marked plan changes the button to "Continue"; selecting a paid plan shows the amount again
  • After being redirected, go back to the join page: the form starts from the details step
  • A Donation Supporter Mode block behaves as before
  • CI e2e job passes

🤖 Generated with Claude Code

conatus and others added 12 commits September 30, 2026 16:40
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ment

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@conatus conatus left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This looks good, and obviously a lot of tests which seem to work. One comment.

Comment thread packages/join-block/src/Settings.php Outdated
Field::make('checkbox', 'redirect_instead_of_payment', 'Redirect to a page instead of taking payment')
->set_help_text(
'People who choose this plan are sent to the page below instead of paying. ' .
'They are not signed up as members. Has no effect when Donation Supporter Mode is enabled.'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

"They are not signed up as members and not recorded in any attached CRM".

Even better if it intelligently detects the CRMs setup and provides this in context.

"They are not signed up as members and not recorded in Action Network and Mailchimp"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done. The help text now names whichever of Action Network, Mailchimp and Zetkin are switched on, for example "They are not signed up as members and not recorded in Action Network and Mailchimp." With none switched on it says "They are not signed up as members." Covered by unit tests and an e2e test on the settings page and in the block editor. The e2e test caught that settings can't be read until the settings container is registered, so the text is filled in at that point.

conatus and others added 7 commits October 1, 2026 15:43
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@conatus
conatus merged commit 3ebbb5d into master Oct 1, 2026
3 checks passed
@conatus conatus changed the title Let a membership plan redirect to a page instead of taking payment JOIN-147 Let a membership plan redirect to a page instead of taking payment Oct 1, 2026
@conatus
conatus deleted the feature/membership-plan-redirect branch October 1, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant