Invite links: page selector + auto-redirect for stray tokens #19

Merged
thatguygriff merged 2 commits from fix/invite-registration-page-selector into main 2026-06-07 13:43:34 +00:00
Owner

Follow-up to #16 (account registration, #18): make invitation links land on the right page.

Changes

  1. Registration Page selector on the Invites admin page (wp_dropdown_pages), stored in the us_registration_page_id option. Invitation links point at the selected page (get_permalink), falling back to the home page when unset (with a warning notice).
  2. Auto-redirect (RegistrationPage::maybeRedirectToRegistrationPage(), hooked on template_redirect): any front-end request carrying a us_invite token is redirected to the configured registration page (token preserved) unless already there — so links generated/shared before a page was selected still work. No-op when no page is set.
  3. Button rename: the invite button now reads "Generate Invitation Link" (was "Send Invite").

RegistrationController gained the OPTION_PAGE constant and a set_page action. Doc updated.

Verification

composer test (104 tests), composer cs, PHPStan level 6, and the no-debug check all pass.

🤖 Generated with Claude Code

Follow-up to #16 (account registration, #18): make invitation links land on the right page. ## Changes 1. **Registration Page selector** on the **Invites** admin page (`wp_dropdown_pages`), stored in the `us_registration_page_id` option. Invitation links point at the selected page (`get_permalink`), falling back to the home page when unset (with a warning notice). 2. **Auto-redirect** (`RegistrationPage::maybeRedirectToRegistrationPage()`, hooked on `template_redirect`): any front-end request carrying a `us_invite` token is redirected to the configured registration page (token preserved) unless already there — so links generated/shared *before* a page was selected still work. No-op when no page is set. 3. **Button rename**: the invite button now reads **"Generate Invitation Link"** (was "Send Invite"). `RegistrationController` gained the `OPTION_PAGE` constant and a `set_page` action. Doc updated. ## Verification `composer test` (104 tests), `composer cs`, PHPStan level 6, and the no-debug check all pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
thatguygriff added 1 commit 2026-06-07 13:25:09 +00:00
Add registration-page selector to the Invites page
CI / Coding Standards (pull_request) Successful in 1m4s
CI / PHPStan (pull_request) Successful in 1m3s
CI / Tests (PHP 8.1) (pull_request) Successful in 50s
CI / Tests (PHP 8.2) (pull_request) Successful in 52s
CI / Tests (PHP 8.3) (pull_request) Successful in 46s
CI / No Debug Code (pull_request) Successful in 3s
CI / Build Plugin Zip (pull_request) Has been skipped
372f981a08
Invitation links previously pointed at the site home page, which usually
does not host the [us_student_register] shortcode. Let the studio admin
choose the registration page (stored in the us_registration_page_id
option); invitation links now point there, falling back to the home page
when unset (with a warning notice).

- RegistrationController: OPTION_PAGE constant; set_page action; pass the
  page id/url to the template.
- templates/admin/invites.php: wp_dropdown_pages selector + save; build the
  invite link from the selected page.
- Doc updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
thatguygriff added 1 commit 2026-06-07 13:31:15 +00:00
Auto-redirect invite tokens to the registration page; rename invite button
CI / Coding Standards (pull_request) Successful in 55s
CI / PHPStan (pull_request) Successful in 59s
CI / Tests (PHP 8.1) (pull_request) Successful in 51s
CI / Tests (PHP 8.2) (pull_request) Successful in 50s
CI / Tests (PHP 8.3) (pull_request) Successful in 47s
CI / No Debug Code (pull_request) Successful in 3s
CI / Build Plugin Zip (pull_request) Has been skipped
330900a246
- RegistrationPage::maybeRedirectToRegistrationPage() (hooked on
  template_redirect): any front-end request carrying a us_invite token is
  redirected to the configured registration page (token preserved), unless
  already there. Covers links shared before a page was selected; no-op when
  no page is set.
- Invites button text: "Send Invite" -> "Generate Invitation Link".
- Doc updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
thatguygriff changed title from Add registration-page selector to the Invites page to Invite links: page selector + auto-redirect for stray tokens 2026-06-07 13:31:30 +00:00
thatguygriff merged commit d0dddd9075 into main 2026-06-07 13:43:34 +00:00
thatguygriff deleted branch fix/invite-registration-page-selector 2026-06-07 13:43:34 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#19