Alpha release May 07#318
Merged
chickenn00dle merged 3 commits intoalphafrom May 7, 2026
Merged
Conversation
…314) `Woocommerce_Membership_Updated::transfer_membership()` rewrites `post_author` on the user_membership to reassign ownership. For team-owned memberships (those with a `_team_id` meta), that's insufficient: true ownership lives on the team post's `_member_id`, the linked subscription's `_customer_user`, and team_member user meta. Rewriting only `post_author` silently desyncs those and can trigger duplicate-team creation on the next renewal dispatch. Skip the transfer (with a log note) when the membership carries `_team_id`. Team ownership transfers must be handled at the team level, not via the user_membership post. Refs NPPM-2741. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the WooCommerce Membership “updated” incoming event handler to avoid transferring team-owned memberships by rewriting post_author, and adds a unit test to assert that behavior. It also refreshes translation template metadata/references as part of the release.
Changes:
- Skip membership ownership transfer when the membership is marked as team-owned (has
_team_idmeta). - Add a unit test covering the “skip transfer for team-owned membership” case.
- Update
newspack-network.potheader date and source line references.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/unit-tests/test-membership-transfer.php | Adds a unit test ensuring team-owned memberships are not transferred via post_author rewrite. |
| includes/incoming-events/class-woocommerce-membership-updated.php | Adds a guard to skip transfers for memberships with _team_id meta. |
| languages/newspack-network.pot | Regenerates POT metadata and updates source references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+184
to
+200
| // Skip team-owned memberships: their ownership lives on the team post's `_member_id`, | ||
| // the linked subscription's `_customer_user`, and team_member user meta – rewriting only | ||
| // `post_author` here would silently desync all of those and break renewal dispatch. | ||
| // Team ownership transfers must be handled at the team level, not the user_membership level. | ||
| $team_id = get_post_meta( $existing_membership_id, '_team_id', true ); | ||
| if ( ! empty( $team_id ) ) { | ||
| Debugger::log( | ||
| sprintf( | ||
| 'Skipping transfer of team-owned membership #%d (team #%s) from %s to %s. Team memberships cannot be transferred via post_author alone.', | ||
| $existing_membership_id, | ||
| $team_id, | ||
| $previous_email, | ||
| $new_user->user_email | ||
| ) | ||
| ); | ||
| return; | ||
| } |
|
🎉 This PR is included in version 2.20.1-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
A new alpha release.