• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Getting Poster ID

Jeremy

Well-known member
#1
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
#2
$visitor = XenForo_Visitor::getInstance();
$visitor['user_id']

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

Jeremy

Well-known member
#3
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
#4
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.