• 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

NinaMcI

Active member
#1
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.
 

Chris D

XenForo developer
Staff member
#2
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>
 

rafass

Well-known member
#4
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>
It also hide Random Media in the sidebar. I would like to show it to everyone. it's possible?
 
Last edited:

Chris D

XenForo developer
Staff member
#5
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

Well-known member
#6
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 -->
Spot on! This is the code! thank you so much! Chris! (y)
xF.1.4.4