Getting Poster ID

Jeremy

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?
 

Jaxel

Well-known member
$visitor = XenForo_Visitor::getInstance();
$visitor['user_id']

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

Jeremy

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).
 

Indigo

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.
 

Jeremy

Well-known member
Hm... That seems a lot more confusing that I wish it was. Especially cause the basis was oh so much more easy.
 
Top