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

Current post id from bb code formatter

#1
I'm trying to find out the post id a bb code belongs to from the bb code formatter.
I've dump recursively the three arrays I have access to from that bb code callback: tag, renderStates and view parameters but it seems they do not contain the information I'm looking for.

Now knowing that the view is of type XenForo_ViewPublic_Thread_View I'm trying to fish that information from some other callback.
Surely somewhere there is a loop that goes through each posts on the page and renders the bb codes.
I wonder if I can somehow dump the callstack from PHP, that could help I guess.
That or proper development documentation, ho wait...
 
#2
Here is my callstack:
Code:
[line13]XenForo_FrontController.run
[line158]XenForo_FrontController.renderView
[line639]XenForo_ViewRenderer_HtmlPublic.renderContainer
[line124]XenForo_Template_Public.render
[line110]XenForo_Template_Abstract.render
[line191]XenForo_Template_Abstract._renderInternal
[line265].eval
[line1789]XenForo_BbCode_TextWrapper.__toString
[line119]XenForo_BbCode_Parser.render
[line505]BBM_BbCode_Formatter_Base.renderTree
[line1542]XenForo_BbCode_Formatter_Base.renderTree
[line526]BBM_BbCode_Formatter_Base.renderSubTree
[line1605]XenForo_BbCode_Formatter_Base.renderSubTree
[line546]XenForo_BbCode_Formatter_Base.renderTreeElement
[line565]BBM_BbCode_Formatter_Base.renderTag
[line1622]XenForo_BbCode_Formatter_Base.renderTag
[line652]BBM_BbCode_Formatter_Base.renderValidTag
[line814]XenForo_BbCode_Formatter_Base.renderValidTag
[line745].call_user_func
[line]Slions_Toc_BbCode_Formatter_Base.renderTagHeader
Here is the code I used to produce it:
Code:
  public function whoDidThat()
  {
        $who=debug_backtrace();
        $result="";
        $count = 0;
        $last=count($who);
        foreach($who as $k=>$v)
        {
            if ($count++ > 0)
            {
                $x="";
                if ( $count>2)
                {
                    $x="<br>";
                }
                $result="[line".$who[$k]['line']."]".$who[$k]['class'].".".$who[$k]['function'].$x.$result;
            }
        }
        return $result;
    }
Now I just have to dig.