Opened 3 years ago
Last modified 20 months ago
#3474 new defect (bug)
Subscriptions don't trigger for moderation-held topics/replies
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | API - Subscriptions | Keywords: | |
| Cc: |
Description
This was reported 4 years ago for the WordPress.org Support Forums, but I believe it's a bug within the way forum/topic subscriptions work within bbPress with relation to moderation/anti-spam. I was unable to find a relevant bbPress ticket describing this.
In short..
- Forum notifications (
bbp_notify_forum_subscribers()) is hooked tobbp_new_topic(and nothing else, nor is it called from elsewhere) bbp_notify_forum_subscribers()checks a topic is public before notifying, via bbp_is_topic_publicbbp_new_topicis triggered from withinbbp_new_topic_handler(), which is not called during unspam/approve flows.
Replies have a similar flow.
It seems like there needs to be a new action, bbp_new_topic_published which is triggered by being hooked to bbp_{new,unspammed,approved}_topic.
Alternatively, bbp_notify_forum_subscribers() should be hooked to bbp_{unspammed,approved}_topic. However, there is also the case where those actions should only run once per topic (ie. if it's published, unapproved, then re-approved, it wouldn't make sense to send a notification).
On WordPress.org, I've worked around this by triggering the action bbp_new_topic after unspamming/approving if it wasn't run with a published topic the first time. This is achieved by adding postmeta that specifies the action needs to be re-run. I took the direction of re-running actions, as we have a number of plugins which are hooked to that and bail if the topic isn't public. See https://meta.trac.wordpress.org/changeset/11978 for this implementation.