XF 2.0 Get post_id after replier


Well-known member
This is the current code and need to figure out the correct way to grab the post_id after the save():

$visitor = \XF::visitor();
$message = $commentdata->comment_content;

if ( $thread_id !== false && $thread_id !== null && $visitor['is_banned'] != 1 ) {

 $replier = \XF::app()->service('XF:Thread\Replier', $thread);

 $post_id = $replier;
I tried $replier['post_id'] and see it is an object. This makes sense based on the var_dump / dump but now I'm uncertain how to get the post_id or if it is even possible.

An exception occurred: [Error] Cannot use object of type XF\Service\Thread\Replier
Thank you for any suggestions.


Well-known member
Thank you @Jeremy P -- I was banging my head up against this for days.


by using $post = $replier->save(); instead of just $replier->save(); was the key!

Now comments from WordPress flow to XenForo and XenForo replies flow to WordPress. Wahooo !