The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
AI Assistant
Live-update notific...
 
Notifications
Clear all

Issue Live-update notification (bubble) never notifies two guest commenters when both leave the comment author email field blank

1 Posts
1 Users
0 Reactions
3 Views
Posts: 13
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@wpdiscuzuser2258)
Eminent Member
Joined: 3 years ago
[#11635]

wpDiscuz version: 7.6.69
Environment: WordPress (ClassicPress-based), PHP, LiteSpeed server, no caching plugin active

Summary:
The bubble/live-update REST endpoint (wp-json/wpdiscuz/v1/update) never returns
newly posted comments in its "ids" field when two different guest visitors post
comments without filling in an email address. The overall "all_comments_count"
does update correctly, but the "ids" array (which drives the notification
bubble/toast) stays empty forever for these visitors, even though the new
comments are approved and clearly exist with a higher comment_ID than the
client's lastId.

Root cause (found by reading includes/class.WpdiscuzDBManager.php):
getNewCommentIds() builds its query with:

... AND `comment_ID` > %d AND `comment_author_email` != %s ...

where %s is the requesting visitor's own email (from $_COOKIE
"comment_author_email_" . COOKIEHASH, or the logged-in user's email).
This is meant to exclude a visitor's own comments from their own
notification feed. However, when a guest commenter does not enter an
email address, comment_author_email is stored as an empty string (‘’).
If a SECOND, completely different guest visitor also leaves the email
field blank, their request also sends email = ''. The exclusion filter
then matches "comment_author_email != ''" as FALSE for the other
visitor's new comment (because it also equals ''), so that comment is
incorrectly treated as "my own" and excluded from `ids` — even though
it was posted by a different person in a different browser.

Steps to reproduce:
1. Open the same post in two different browsers/profiles as two
different anonymous guests (not logged in).
2. In both, submit a comment WITHOUT filling in an email address
(only a display name).
3. Wait for the bubble's live-update poll (wp-json/wpdiscuz/v1/update)
to fire in either browser.
4. Observe: `all_comments_count` increases correctly, but `ids` and
the notification bubble/toast never show the other guest's new
comment — because both share the same blank email identity.
5. For comparison, if one of the two commenters is logged in (so their
email is a real, distinct value), notifications work correctly in
both directions.

Expected behavior:
Two different guest visitors who both leave the email field blank
should still be notified of each other's new comments — an empty
email should not be treated as a shared "identity" for the
self-exclusion filter. Suggested fix: only apply the
`comment_author_email != %s` exclusion when the requester's email is
non-empty, or use a more reliable per-visitor identifier (e.g. a
random per-session cookie/nonce) instead of email for this
self-exclusion check.

Impact:
On a public site where many visitors comment as anonymous guests
without an email address, this silently breaks the live comment
notification feature for a large share of real visitors, not just in
a synthetic multi-browser test.

Happy to share captured network requests/responses (from Chrome
DevTools/Firefox DevTools) and the exact wp_comments rows (comment_ID,
comment_author, comment_author_email) that reproduce this if useful.