-
Notifications
You must be signed in to change notification settings - Fork 58
fix(memberships): restrict commenting to relevant statuses #4396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(memberships): restrict commenting to relevant statuses #4396
Conversation
There was a problem hiding this 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 restricts commenting access to users with active memberships by filtering membership statuses when checking user permissions for the woo-member-commenting module. The fix prevents users with cancelled subscriptions from commenting on restricted posts.
Changes:
- Added status filtering to
wc_memberships_get_user_memberships()call to only include active membership statuses - Explicitly passed user ID to the membership query function
Comments suppressed due to low confidence (1)
includes/optional-modules/class-woo-member-commenting.php:127
- The caching logic is inverted. When
$skip_cacheis false and a cached value exists (not null), the function should return the cached value. However, the current condition returns the cached value when$skip_cacheis true, which defeats the purpose of the skip parameter. The condition should beif ( ! $skip_cache && null !== $require_membership_to_comment )to properly use cached values unless explicitly skipped.
if ( $skip_cache || null !== $require_membership_to_comment ) {
return $require_membership_to_comment;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
## [6.28.2](v6.28.1...v6.28.2) (2026-01-15) ### Bug Fixes * **memberships:** restrict commenting to relevant statuses ([#4396](#4396)) ([a712266](a712266))
|
🎉 This PR is included in version 6.28.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Closes https://linear.app/a8c/issue/NPPM-2524/bug-woo-member-commenting-module-allows-cancelled-memberships-to
This PR fixes an issue where readers with cancelled subscriptions are able to comment when the
woo-member-commentingmodule is active and enabled.We do this by filtering by status when checking a given readers subscriptions (Proposed by Adam Leone in the Linear task).
How to test the changes in this Pull Request:
woo-member-commentingmodule (See instructions on that belowpending-cancelstateSetting up woo member commenting:
wp newspack optional-module activate woo-member-commentingwp-config.php:Other information: