bbp_new_reply action not firing when user replies to embedded thread
-
I’m working an educational website that produces video content and uses a BBPress forum for discussion rather than the native WordPress comments. Here’s how it works:
I have a hook on
wp_insert_post
that creates a new BBPresstopic
when a newvideo
post is created and saves this newtopic_id
to a_comment_topic_id
meta field.In my
single-video.php
template where the video is displayed, I’m using the BBPress[bbp-single-topic id=$topic_id]
shortcode to display the topic thread and reply form for people to post comments.All of this works great! I’m just having one problem – the “subscribe” feature of BBPress isn’t working when people post replies via the Video Single page. The reply is posted just fine, but subscribed users don’t receive a notification. If you’re not familiar – when a user subscribes to a thread, they receive an email whenever someone replies to the thread. This is still working fine when someone posts a reply via the actual Thread single page – it’s only a problem on the thread embedded via the shortcode on the Video single page.
I’ve tried digging into the core and I got so far as to discover that the
bbp_new_reply
action isn’t firing – BBPress uses a function calledbbp_notify_topic_subscribers
hooked intobbp_new_reply
to send the notifications and that function isn’t running at all when a reply is made via the Video single page.It seems that BBPress uses some hidden inputs to determine what actions to run after a reply has been submitted, but those seem to be included properly through the shortcode. These appear at the bottom of the Topic single form (that works properly);
<input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="422573"> <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="0"> <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply"> <input type="hidden" id="_wpnonce" name="_wpnonce" value="83ea236cd1"> <input type="hidden" name="_wp_http_referer" value="/forums/topic/SLUG/">
And these appear at the bottom of the Video single form (that doesn’t)
<input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="422573"> <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="0"> <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply"> <input type="hidden" id="_wpnonce" name="_wpnonce" value="83ea236cd1"> <input type="hidden" name="_wp_http_referer" value="/videos/SLUG/">
I’m at a loss for how to debug this issue further and could really use some help. BBPress has all kinds of page type/post type checks in the core that I’ve been ducking and weaving around, but this one has got me stumped. I suspect the problem is that SOMEWHERE it’s checking the post type of the current post, seeing it’s a
video
instead of atopic
and bailing before the action runs, but I have no idea how or where to find that and how to patch around it.Thanks!
- You must be logged in to reply to this topic.