Getting Poster ID


Well-known member
This may be a little 'advanced.' Is there anyway I can somehow fetch the poster ID for the post that a BB Code is being parsed in? So that BB Codes can conditionally have permission checks?


Well-known member
$visitor = XenForo_Visitor::getInstance();

In templates, "$visitor" is a global variable that is accessible without declaration.


Well-known member
Yeah, but that's the current visitor. I am looking for the ID of the person who posted the post that I'm working with (in BB Code).


Active member
That would just get the person viewing the page, not the person who made the post.

For threads, it looks like you can override XenForo_ViewPublic_Thread_View and swap out the XenForo_ViewPublic_Helper_Message stuff for your own code. $this->_params['posts'] should contain all the message data that you'd need. Other areas like private conversations, signature/post preview, etc. may have to be looked into the same way.