I’m using DC SSO where users are managed by WP. The forum acts as a way to comment on posts, but these posts are only visible in the forum.
I have a custom “Comment” button in WP that turns into “x comments” when there are coments in the linked topic. (It uses normal WP get_comments_number that the DC plugin hooks into.)
It works well, but I’ve just tried deleting a post and the count remains the same. The UI in the WP plugin recommends: Events: "Post is created", "Post is updated".
Based on that, it is perhaps not supported? To decrease or recalculate post/comment count.
I’m trying to understand how you’ve set this up. Please correct me if I’m wrong:
You use Publishing and DiscourseConnect feature sets of the plugin.
You do (not) have “Enable Discourse Comments” enabled (?: this is unclear)
You have the “Sync Comment Data” webhook enabled.
You have added a custom button at the bottom of the Wordpress posts linked to Discourse that displays the count of Discourse posts on a topic. It uses the get_comments_number Wordpress filter.
You want the count to be updated when posts in the linked topic are deleted.
Is that right? What else have you set up (or not)?
I do not have Enable Discourse Comments checked. I don’t use WP-native PHP display features at all, and this is part of a custom React UI, fed by an api va JS. The only thing I use related to comments is getting their count. Everything else is offloaded to Discourse behind a button.
Ok. I think adding delete post support to the WP Discourse topic webhook is reasonable. I’ll do that in the next version (soon). I won’t be able to support your specific custom implementation, but I’ll add support for that event.
Plugin version 2.5.5
DC version 3.4.0.beta3-dev (876591fdab)
Settings for webhooks post events cover deleting and restoration (all checked).
Posting a comment immediately increases the counter as expected.
Upon deleting my only post in the topic, the counter in WP stays on 1.
Upon restoring it stays on 1 as well.
So no, it doesn’t work, unless I’m supposed to perma-delete my post or wait 10 minutes or similar. I purged the caching plugin between refreshes as well.
For me, it says it’s the latest. I’ll wait until the newer update appears and perhaps start it during the night. I’d rather not update to an advance version if it involves manual update, as we only have a live site, no staging.
Discourse will only complain about being out of date on version changes, however lots of smaller changes get made in the middle and can be pulled in whenever you want by updating or rebuilding.