Skip to content

Integrate Customer Reviews for WooCommerce anonymity: show "Anonymous" in review notifications#130

Open
ZebaAfiaShama wants to merge 1 commit into
WPDevelopers:masterfrom
ZebaAfiaShama:fix/cusrev-anonymous-reviews
Open

Integrate Customer Reviews for WooCommerce anonymity: show "Anonymous" in review notifications#130
ZebaAfiaShama wants to merge 1 commit into
WPDevelopers:masterfrom
ZebaAfiaShama:fix/cusrev-anonymous-reviews

Conversation

@ZebaAfiaShama

Copy link
Copy Markdown

Summary

Integrates NotificationX with the Customer Reviews for WooCommerce (CusRev) plugin's anonymity feature. When a customer submits a product review anonymously, the social-proof notification now shows "Anonymous" instead of leaking the account display name / email prefix (e.g. "X123" for X123@gmail.com).

The problem

When a customer picks Anonymous as their Display name on CusRev's review (reminder/aggregated) form, CusRev stores the review with comment_author = "Anonymous" while the verified buyer's WordPress user_id and email stay attached to the comment.

WooReviews::add() checked user_id first and used the account display_name (often the email prefix), ignoring the comment_author. So the notification displayed the customer's identity — exactly what they asked to hide. The retained email also resolved to their gravatar.

The fix

In includes/Extensions/WooCommerce/WOOReviews.php, after building the review data, detect anonymous reviews and surface a neutral label:

  • Anonymous when: comment_author equals CusRev's "Anonymous" label (localized string or English fallback) while CusRev is active (Ivole/CR_Reviews), or comment_author is empty (guest reviews / imports — matches CusRev's own Google-feed heuristic).
  • On anonymous: set username/name to "Anonymous", blank the email (so no name, email prefix or gravatar leaks), flag is_anonymous.
  • Normal reviews are untouched.
  • Filterable: nx_woo_review_anonymous_label, nx_is_anonymous_review.

Testing

Verified end-to-end in a WordPress + WooCommerce 10.9.1 + Customer Reviews for WooCommerce 5.113.0 sandbox:

  • Reproduced a real anonymous review through CusRev's own storage path (CR_Endpoint::create_review) → stored as comment_author="Anonymous", user_id set, email retained.
  • Live NotificationX popup now renders "Anonymous just reviewed …" with the default avatar (no gravatar leak).
  • Controls (logged-in named review, guest named review) still display the real name.

No behavior change for non-CusRev or non-anonymous reviews.

When a customer submits a product review anonymously via the "Customer
Reviews for WooCommerce" (CusRev) plugin, the review is stored with
comment_author set to CusRev's "Anonymous" label while the verified
buyer's WordPress user id and email stay attached to the comment.

WooReviews::add() took the user-id branch and used the account display
name (often the email prefix, e.g. "X123" for X123@gmail.com), so the
notification leaked the identity the customer asked to hide — and the
retained email also resolved to their gravatar.

Detect anonymous reviews (CusRev's "Anonymous" author label when CusRev
is active, or an empty comment_author) and surface a neutral "Anonymous"
label, dropping the email so no name, email prefix or gravatar is shown.
Both the label and the detection are filterable (nx_woo_review_anonymous_label,
nx_is_anonymous_review).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant