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

An oddity with the 'sidebar_visitor_panel_stats' template hook

Discussion in 'XenForo Development Discussions' started by Jake B., Sep 17, 2014.

  1. Jake B.

    Jake B. Well-Known Member

    Not sure if this is intentional or not, but in template 'sidebar_visitor_panel' there are the following lines:

            <div class="visitorText">
                <h2>{xen:phrase signed_in_as_x_sidebar, 'name={xen:helper username, $visitor, 'NoOverlay'}'}</h2>       
                <div class="stats">
                <xen:hook name="sidebar_visitor_panel_stats">
                    <dl class="pairsJustified"><dt>{xen:phrase messages}:</dt> <dd>{xen:number $visitor.message_count}</dd></dl>
                    <dl class="pairsJustified"><dt>{xen:phrase likes}:</dt> <dd>{xen:number $visitor.like_count}</dd></dl>
                    <dl class="pairsJustified"><dt>{xen:phrase points}:</dt> <dd>{xen:number $visitor.trophy_points}</dd></dl>
    It seems a bit odd that the hook starts inside the <div> tag, but ends after the </div> Not sure if this is intentional, but it makes it a bit weird to add in new stats, still entirely possible to do, but a bit odd. Just was curious what the purpose of this was, perhaps @Jake Bunce or @Brogan knows, since they seems to know everything :)
  2. Lawrence

    Lawrence Well-Known Member

    For you can easily add in your own stats via loading a new template or just appending your own <dl>...</dl> from your listener without needing to use a search and replace expression in it. For example:
    $contents '<dl class = ... >blah blah</dl>' $contents
    Even though that hook is there and by its nature makes adding in your own stats easy, you should not use hooks, but rather your own template modification. Hooks are deprecated, IIRC.
    Jake B. likes this.
  3. Jake B.

    Jake B. Well-Known Member

    It seems that you are absolutely right, thanks for that!

Share This Page