Skip to content

fix: protect review owner notifications and moderation permissions - #3016

Open
RabbiIslamRony wants to merge 1 commit into
developmentfrom
fix/3317-review-notification-permissions
Open

RabbiIslamRony wants to merge 1 commit into
developmentfrom
fix/3317-review-notification-permissions

Conversation

@RabbiIslamRony

@RabbiIslamRony RabbiIslamRony commented Sep 14, 2026

Copy link
Copy Markdown
Member

PR Type

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

Approving a listing review could send its owner a WordPress comment email containing the reviewer's IP/hostname and moderation links. Owners could then mark another user's review as spam using their listing-edit permissions, even without moderate_comments.

Require moderation permission for native comment actions and keep frontend author content editing separate. Send the owner one approval-driven notification containing the listing, public reviewer name, rating, review text and public link. Suppress WordPress's default review-owner email, exclude private reviewer fields from the body and headers, honor the notification setting, and avoid duplicates on reapproval. Correct the exception arguments on denied frontend edits so rejection does not trigger a PHP error.

How to test

  1. Enable owner review notifications. Use separate listing-owner and reviewer subscriber accounts without moderate_comments. Submit a pending review and verify no owner notification is sent.
  2. Approve as administrator. Verify one owner email with the public name, star rating and review text; no reviewer email/IP/hostname or admin links. Repeat with immediate approval and a guest review. Reapproval must not send another email.
  3. As the owner, verify direct native spam/trash/edit actions and WordPress REST review edits are denied, including requests with valid nonces. Confirm an administrator can still moderate.
  4. Confirm reviewers can open the frontend form for their own review and owners can edit their own reply, but owners cannot edit another person's review. Ordinary blog comment permissions and notifications should remain unchanged.
  5. With the companion Advanced Review fix installed, follow the email link and confirm the target review is visible, including when it is on a later page.

Validation

  • 35 WP-CLI integration assertions passed with Core alone and with Advanced Review active.
  • Real HTTP checks passed for native moderation with valid nonces, WordPress REST denial, frontend form denial and own-reply editing.
  • Actual Advanced Review REST submissions verified pending and immediate-approval notification behavior. Mail was intercepted locally.
  • PHP syntax and repository PHPCS checks passed for changed files using the CI setting --warning-severity=0. GitHub PHPCS run passed.
  • Tested locally on WordPress 7.1, PHP 8.2.29, Directorist 8.9.4 and Advanced Review 1.0.3. No client-site deployment was performed.

Before and after screenshots

Screenshots will be attached manually before this draft is marked ready for review.

Scenario Before After
Owner notification email Attach email showing private fields and admin links Attach approved-review email showing public name, rating and public link
Listing owner moderation Attach owner-accessible Moderate Comment screen Attach denied owner moderation request

Any linked issues

Checklist

  • My code follows the WordPress coding standards enforced by the repository's CI configuration.
  • Before and after screenshots attached manually.

@RabbiIslamRony
RabbiIslamRony marked this pull request as ready for review September 14, 2026 05:03
@Armanul46 Armanul46 added this to the v8.9.6 milestone Sep 16, 2026
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.

2 participants