Skip to content

Alpha release May 07#318

Merged
chickenn00dle merged 3 commits intoalphafrom
trunk
May 7, 2026
Merged

Alpha release May 07#318
chickenn00dle merged 3 commits intoalphafrom
trunk

Conversation

@chickenn00dle
Copy link
Copy Markdown
Contributor

A new alpha release.

adekbadek and others added 3 commits April 23, 2026 09:26
…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>
Copilot AI review requested due to automatic review settings May 7, 2026 14:49
@chickenn00dle chickenn00dle requested a review from a team as a code owner May 7, 2026 14:49
Copy link
Copy Markdown

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

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_id meta).
  • Add a unit test covering the “skip transfer for team-owned membership” case.
  • Update newspack-network.pot header 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;
}
@chickenn00dle chickenn00dle merged commit 3f7fdbc into alpha May 7, 2026
17 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🎉 This PR is included in version 2.20.1-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

4 participants