The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
AI Assistant
Bell (per-comment) ...
 
Notifications
Clear all

Issue Bell (per-comment) subscriptions are deleted when a user subscribes via the box above the comments

1 Posts
1 Users
0 Reactions
9 Views
Posts: 14
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
(@accelera)
Eminent Member
Joined: 3 months ago
[#11695]

Hi wpDiscuz team,

I found a bug in the subscription logic. I'm on one of the latest versions (7.6.72).

What happens
When a user subscribes through the box above the comments ("new follow-up comments" or "new replies to my comments"), any bell subscriptions they already have on that post are deleted. The more general subscription replaces the more specific one.

Steps to reproduce

  1. Post a comment with no subscription selected, then click the bell on it.
  2. Subscribe through the box above the comments, choosing "new follow-up comments", with the same email address.
  3. In wp-admin, the bell subscription (type comment) has been replaced by a post subscription.
  4. Reply directly to the first comment from a different email address.
  5. The first user gets the generic "New Comment" email, not "New Reply On Your Comment".

If the order is reversed (box first, bell second), the bell survives. The result depends on the order of actions, which looks unintended.

Cause
From reading the source, addEmailNotification() in class.WpdiscuzDBManager.php calls deleteCommentNotifications() whenever the type is not comment. That runs:

DELETE FROM wc_comments_subscription
WHERE subscribtion_type != 'post' AND post_id = %d AND email = %s

This removes every subscription for that email on the post except post rows, including the bell (comment) rows.

Expected behavior
A broader subscription shouldn't remove a more specific one. Users who enabled the bell should still get "New Reply On Your Comment" for direct replies.

Suggested fix
Exclude comment rows from that delete, so only all_comment rows are replaced. If both a bell and a broad subscription then match one comment, sending only the most specific email would avoid duplicates, in the order bell, then "replies to my comments", then "follow-up comments".

Thanks for looking into this. I can provide more details if needed.