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

XF 1.4 Forum statistics for admin only

Discussion in 'XenForo Questions and Support' started by NinaMcI, Oct 8, 2014.

  1. NinaMcI

    NinaMcI Active Member

    Is there a way to show the Forum Statistics box in the sidebar to the admin user group only?

    My forum is very new so there is very little traffic at the moment - I don't want the stats to put visitors off registering.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    There is a permission as to who can view member lists which would prevent users from seeing the list of online members, so that may be useful.

    Also in the template forum_list, to hide the stats from all but admins you can find this:

    Code:
    <!-- block: forum_stats -->
    <div class="section">
        <div class="secondaryContent statsList" id="boardStats">
            <h3>{xen:phrase forum_statistics}</h3>
            <div class="pairsJustified">
                <dl class="discussionCount"><dt>{xen:phrase discussions}:</dt>
                    <dd>{xen:number $boardTotals.discussions}</dd></dl>
                <dl class="messageCount"><dt>{xen:phrase messages}:</dt>
                    <dd>{xen:number $boardTotals.messages}</dd></dl>
                <dl class="memberCount"><dt>{xen:phrase members_count}:</dt>
                    <dd>{xen:number $boardTotals.users}</dd></dl>
                <dl><dt>{xen:phrase latest_member}:</dt>
                    <dd><xen:username user="$boardTotals.latestUser" /></dd></dl>
                <!-- slot: forum_stats_extra -->
            </div>
        </div>
    </div>
    <!-- end block: forum_stats -->
    And replace it with:

    Code:
    <xen:if is="{$visitor.is_admin}">
        <!-- block: forum_stats -->
        <div class="section">
            <div class="secondaryContent statsList" id="boardStats">
                <h3>{xen:phrase forum_statistics}</h3>
                <div class="pairsJustified">
                    <dl class="discussionCount"><dt>{xen:phrase discussions}:</dt>
                        <dd>{xen:number $boardTotals.discussions}</dd></dl>
                    <dl class="messageCount"><dt>{xen:phrase messages}:</dt>
                        <dd>{xen:number $boardTotals.messages}</dd></dl>
                    <dl class="memberCount"><dt>{xen:phrase members_count}:</dt>
                        <dd>{xen:number $boardTotals.users}</dd></dl>
                    <dl><dt>{xen:phrase latest_member}:</dt>
                        <dd><xen:username user="$boardTotals.latestUser" /></dd></dl>
                    <!-- slot: forum_stats_extra -->
                </div>
            </div>
        </div>
        <!-- end block: forum_stats -->
    </xen:if>
     
  3. NinaMcI

    NinaMcI Active Member

    Thanks very much for your help.
     
    Chris D likes this.
  4. rafass

    rafass Well-Known Member

    It also hide Random Media in the sidebar. I would like to show it to everyone. it's possible?
    [​IMG]
     
    Last edited: Jan 24, 2015
  5. Chris D

    Chris D XenForo Developer Staff Member

    Probably this:

    Code:
    <!-- block: forum_stats -->
    <xen:if is="{$visitor.is_admin}">
        <div class="section">
            <div class="secondaryContent statsList" id="boardStats">
                <h3>{xen:phrase forum_statistics}</h3>
                <div class="pairsJustified">
                    <dl class="discussionCount"><dt>{xen:phrase discussions}:</dt>
                        <dd>{xen:number $boardTotals.discussions}</dd></dl>
                    <dl class="messageCount"><dt>{xen:phrase messages}:</dt>
                        <dd>{xen:number $boardTotals.messages}</dd></dl>
                    <dl class="memberCount"><dt>{xen:phrase members_count}:</dt>
                        <dd>{xen:number $boardTotals.users}</dd></dl>
                    <dl><dt>{xen:phrase latest_member}:</dt>
                        <dd><xen:username user="$boardTotals.latestUser" /></dd></dl>
                    <!-- slot: forum_stats_extra -->
                </div>
            </div>
        </div>
    </xen:if>
    <!-- end block: forum_stats -->
     
    rafass likes this.
  6. rafass

    rafass Well-Known Member

    Spot on! This is the code! thank you so much! Chris! (y)
    xF.1.4.4
     

Share This Page