Trouble with $topic_id = bbp_get_reply_topic_id( $reply_id );
Various email notification functions work when a topic or reply is submitted or edited from the frontend but not from the backend. I have code which is hooked on to transition_post_status to take over notification functions when a topic or reply is published from the front or backend. It works great for topics, but I am having trouble with replies.
I have the following code fragment fired on publication of a reply:
$reply_id = bbp_get_topic_id( $post->ID ); $topic_id = bbp_get_reply_topic_id( $reply_id ); $forum_id = bbp_get_topic_forum_id( $topic_id ); $reply_author_id = bbp_get_reply_author_id($reply_id); error_log("Trace point reply to be published topic_id:". strval($topic_id) . " reply_id: " . strval($reply_id) . " forum_id: " . strval($forum_id). " author_id: " . strval($reply_author_id));
In all cases, $reply_id and $reply_author_id are found correctly.
When invoked from the frontend, $forum_id is found correctly, but not from the backend.
$topic_id is shown as zero whether from front or backend.
So bbp_get_reply_topic_id($reply_id) is not functioning as I anticipate. I have tried bbp_get_reply_topic_id( $$post->ID ) with the same result.
How do I get the topic_id from the reply_id? Can SKS please help here?
- You must be logged in to reply to this topic.