An oddity with the 'sidebar_visitor_panel_stats' template hook

Jake B.

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

Code:
        <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>
            </div>
            </xen:hook>
        </div>

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 :)
 
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:
PHP:
$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.
 
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:
PHP:
$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.

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