Skip to content

fix(group-subscription): update params; avoid secondary My Account redirect#151

Open
dkoo wants to merge 11 commits into
releasefrom
hotfix/group-subscription-invite-link-params
Open

fix(group-subscription): update params; avoid secondary My Account redirect#151
dkoo wants to merge 11 commits into
releasefrom
hotfix/group-subscription-invite-link-params

Conversation

@dkoo
Copy link
Copy Markdown
Contributor

@dkoo dkoo commented May 28, 2026

All Submissions:

Changes proposed in this Pull Request:

This fixes an issue with the implementation of group subscription invite URLs. The short s (for subscription ID) param collides with WordPress core's reserved search param, which prevents group subscription invite links from fully processing. The fix: rename the required params so they're less likely to collide with params used for other purposes:

  • s becomes subscription
  • m becomes manager
  • k becomes key

Also fixes a second issue where redirecting to the base My Account URL to display an error message results in a secondary redirect to the edit-account sub-page, which strips params and prevents the user-facing snackbar message from appearing. The fix: always redirect straight to the edit-account page so the params aren't stripped in the secondary redirect.

How to test the changes in this Pull Request:

  1. Check out this branch.
  2. On a site with NEWSPACK_CONTENT_GATES enabled, create a group subscription and assign to a reader who will be the manager.
  3. While logged in as the manager user, visit My Account > My Subscription > [kebab menu] Manage members > [kebab menu] Copy invite link.
  4. In a new session, visit the invite link generated in step 2 while both logged out and logged in as a different reader. Confirm expected behavior:
  • While logged out: redirected to the My Account login page with a snackbar message: Please log in or register an account to join the group.
  • While logged in: redirected to the My Account page for the group subscription with a snackbar message: You have successfully joined the group!
  • After joining the group, the reader is added as a member to the group subscription.
  1. In another new session, visit an invalid link (https://site.com/?action=group_invite_link&subscription=0&manager=0&key=0) while both logged out and logged in as a reader. Confirm expected behavior:
  • While logged out: redirected to the site's homepage with a snackbar message: This link is no longer valid. Please contact the group manager.
  • While logged in: redirected to the My Account "edit account" page with snackbar message: This link is no longer valid. Please contact the group manager.

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 run tests with your changes locally?

@dkoo dkoo self-assigned this May 28, 2026
Copilot AI review requested due to automatic review settings May 28, 2026 22:05
@dkoo dkoo requested a review from a team as a code owner May 28, 2026 22:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a collision between the short s invite-link query arg and WordPress core's reserved s (search) parameter, which prevented group-subscription invite links from completing. Also routes My Account error redirects straight to the edit-account endpoint so an existing secondary redirect doesn't strip the result params before the snackbar can render. Tests are updated to match the new param names.

Changes:

  • Rename invite-link query args: ssubscription, mmanager, kkey in URL builder and request handler.
  • Replace base My Account permalink with wc_get_account_endpoint_url( 'edit-account' ) in both process_invite_request and process_link_invite_request to avoid the secondary redirect that strips query args.
  • Update unit tests, plus version/changelog and a newspack-scripts dependency change.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
plugins/newspack-plugin/includes/plugins/woocommerce-subscriptions/group-subscription/class-group-subscription-invite.php Renames invite query params and switches My Account redirect target to the edit-account endpoint.
plugins/newspack-plugin/tests/unit-tests/content-gate/group-subscriptions.php Updates $_GET keys and URL-format assertions to use the new subscription/manager/key params.
plugins/newspack-plugin/newspack.php Bumps plugin header version to 6.41.4-hotfix-group-subscription-invite-link-params.1.
plugins/newspack-plugin/package.json Bumps version and changes newspack-scripts from workspace:* to 5.9.8 (deviates from other plugins).
plugins/newspack-plugin/CHANGELOG.md Manually adds a hotfix changelog entry that is normally generated by CI.

Comment thread plugins/newspack-plugin/package.json Outdated
Comment thread plugins/newspack-plugin/CHANGELOG.md Outdated
@dkoo dkoo force-pushed the hotfix/group-subscription-invite-link-params branch from 7894b87 to 54be7db Compare June 1, 2026 17:59
dkoo and others added 4 commits June 1, 2026 12:01
… [skip ci]

## newspack [6.41.4-hotfix-group-subscription-invite-link-params.1](https://github.com/Automattic/newspack-workspace/compare/newspack@6.41.3...newspack@6.41.4-hotfix-group-subscription-invite-link-params.1) (2026-06-01)

### Bug Fixes

* **group-subscription:** update param names, avoid secondary My Account redirect ([52ebcd6](52ebcd6))
* revert unwanted chagnes ([6579a25](6579a25))
# Conflicts:
#	plugins/newspack-plugin/CHANGELOG.md
#	plugins/newspack-plugin/newspack.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants