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

XF 1.2 Can't add resource count to visitor panel

Discussion in 'Styling and Customization Questions' started by Matthew Hawley, Jul 16, 2013.

  1. Matthew Hawley

    Matthew Hawley Well-Known Member

    I added this to the visitor panel and it didn't work. Here is what I have.

    Code:
    <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>
                    <xen:if is="{$user.resource_count}"><dl class="pairsJustified"><dt>{xen:phrase resources}:</dt> <dd><a href="{xen:link resources/authors, $user}">{xen:number $user.resource_count}</a></dd></dl></xen:if>
                </div>
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    $user doesn't exist in this context.
     
  3. Matthew Hawley

    Matthew Hawley Well-Known Member

    Okay...so what do i do then?
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Code:
    <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>
                    <xen:if is="{$user.resource_count}"><dl class="pairsJustified"><dt>{xen:phrase resources}:</dt> <dd><a href="{xen:link resources/authors, $user}">{xen:number $user.resource_count}</a></dd></dl></xen:if>
                </div>
    Everything you need is in the code snippet you posted above.
     
  5. le-melvin

    le-melvin Member

    Hello, me its not working
    [​IMG]
    Code:
    <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>J'aime:</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>
                    <dl class="pairsJustified"><dt>Télechargements:</dt> <dd>{xen:number $author.resource_count}</dd></dl>
                    </div></xen:hook>
     
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    You shouldn't be using $author. You should be using $visitor.
     

Share This Page