XF 1.2 Show Moderator Bar to Visitors, Can't Hide Report

faeronsayn

Well-known member
After doing some template edits I needed the moderator bar to be seen by all visitors of my site. So I removed the if statement that restricts it to only be viewed by the admins/moderators. The only problem I am having is hiding the report link in the moderator bar, it is being shown to everyone.

Any idea what if statement I could use for it to only show to moderators / admins, an if statement that'll work in that template.
 
See here for moderator and administrator conditional statements: http://xenforo.com/community/resources/conditional-statements.1604/

Doesn't really help sadly.

I already tried {$visitor.is_moderator} and it's admin counterparts they have a similar effect, the whole moderator bar disappears for normal users.

This time I used your advice and tried the following

Code:
            <xen:if is="{xen:helper ismemberof, $visitor, 3}">
           
            </xen:if>

I wrapped it around the following code like I wrapped the {$visitor.is_moderator} if condition

Code:
            <xen:if is="!{$xenOptions.reportIntoForumId}">
                <a href="{xen:link reports}" class="reportedItems modLink">
                    <span class="itemLabel">{xen:phrase reported_items_short}:</span>
                    <span class="itemCount {xen:if '({$session.reportCounts.total} AND {$session.reportCounts.lastUpdate} > {$session.reportLastRead}) OR {$session.reportCounts.assigned}', 'alert'}" title="{xen:if $session.reportCounts.lastUpdate, '{xen:phrase last_report_update}: {xen:datetime $session.reprotCounts.lastUpdate}'}"><xen:if is="{$session.reportCounts.assigned}">{$session.reportCounts.assigned} / {$session.reportCounts.total}<xen:else />{$session.reportCounts.total}</xen:if></span>
                </a>
            </xen:if>

End result

Code:
            <xen:if is="{xen:helper ismemberof, $visitor, 3}">

            <xen:if is="!{$xenOptions.reportIntoForumId}">
                <a href="{xen:link reports}" class="reportedItems modLink">
                    <span class="itemLabel">{xen:phrase reported_items_short}:</span>
                    <span class="itemCount {xen:if '({$session.reportCounts.total} AND {$session.reportCounts.lastUpdate} > {$session.reportLastRead}) OR {$session.reportCounts.assigned}', 'alert'}" title="{xen:if $session.reportCounts.lastUpdate, '{xen:phrase last_report_update}: {xen:datetime $session.reprotCounts.lastUpdate}'}"><xen:if is="{$session.reportCounts.assigned}">{$session.reportCounts.assigned} / {$session.reportCounts.total}<xen:else />{$session.reportCounts.total}</xen:if></span>
                </a>
            </xen:if>
           
            </xen:if>

All of which doesn't work and makes the moderator bar disappear for normal users.
 
The default value for that is:
HTML:
        <xen:if is="{$visitor.is_moderator}">
                <a href="{xen:link moderation-queue}" class="moderationQueue modLink">
                    <span class="itemLabel">{xen:phrase moderation_queue}:</span>
                    <span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span>
                </a>
               
                <a href="{xen:link reports}" class="reportedItems modLink">
                    <span class="itemLabel">{xen:phrase reported_items}:</span>
                    <span class="itemCount {xen:if {$session.reportCounts.total}, 'alert'}">{$session.reportCounts.total}</span>
                </a>
            </xen:if>

That conditional doesn't work?
 
The default value for that is:
HTML:
        <xen:if is="{$visitor.is_moderator}">
                <a href="{xen:link moderation-queue}" class="moderationQueue modLink">
                    <span class="itemLabel">{xen:phrase moderation_queue}:</span>
                    <span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span>
                </a>
              
                <a href="{xen:link reports}" class="reportedItems modLink">
                    <span class="itemLabel">{xen:phrase reported_items}:</span>
                    <span class="itemCount {xen:if {$session.reportCounts.total}, 'alert'}">{$session.reportCounts.total}</span>
                </a>
            </xen:if>

That conditional doesn't work?

This might be v1.1 code, because my code certainly does not look like that. This issue is for v1.2 by the way.

Here is the original code for moderator bar for v1.2

Code:
<xen:require css="moderator_bar.css" />

<xen:if hascontent="true">
<fieldset id="moderatorBar">
    <div class="pageWidth">
        <div class="pageContent">
        <xen:contentcheck>
            <xen:if is="{$visitor.is_admin}">           
                <a href="admin.php" class="acp adminLink"><span class="itemLabel">{xen:phrase admin_control_panel_short}</span></a>
               
                <xen:if is="{$session.permissionTest}">
                    <a href="{xen:link misc/reset-permissions}" class="permissionTest adminLink OverlayTrigger">
                        <span class="itemLabel">{xen:phrase permissions_from_x, 'name={$session.permissionTest.username}'}</span>
                    </a>
                </xen:if>
            </xen:if>
           
            <xen:if is="{$visitor.is_moderator} AND {$session.moderationCounts.total}">
                <a href="{xen:link moderation-queue}" class="moderationQueue modLink">
                    <span class="itemLabel">{xen:phrase moderation_queue_short}:</span>
                    <span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span>
                </a>
            </xen:if>
           
            <xen:if is="{$visitor.is_moderator} && !{$xenOptions.reportIntoForumId}">
                <a href="{xen:link reports}" class="reportedItems modLink">
                    <span class="itemLabel">{xen:phrase reported_items_short}:</span>
                    <span class="itemCount {xen:if '({$session.reportCounts.total} AND {$session.reportCounts.lastUpdate} > {$session.reportLastRead}) OR {$session.reportCounts.assigned}', 'alert'}" title="{xen:if $session.reportCounts.lastUpdate, '{xen:phrase last_report_update}: {xen:datetime $session.reprotCounts.lastUpdate}'}"><xen:if is="{$session.reportCounts.assigned}">{$session.reportCounts.assigned} / {$session.reportCounts.total}<xen:else />{$session.reportCounts.total}</xen:if></span>
                </a>
            </xen:if>
           
            <xen:if is="{$visitor.is_admin} AND {$session.canAdminUsers} AND {$session.userModerationCounts.total}">
                <a href="admin.php?users/moderated" class="userModerationQueue modLink">
                    <span class="itemLabel">{xen:phrase users_awaiting_approval_short}:</span>
                    <span class="itemCount {xen:if {$session.userModerationCounts.total}, 'alert'}">{$session.userModerationCounts.total}</span>
                </a>
            </xen:if>

            <xen:hook name="moderator_bar" />
        </xen:contentcheck>
           
            <span class="helper"></span>
        </div>
    </div>
</fieldset>
</xen:if>

Out of that code we look at the following code

Code:
            <xen:if is="{$visitor.is_moderator} && !{$xenOptions.reportIntoForumId}">
                <a href="{xen:link reports}" class="reportedItems modLink">
                    <span class="itemLabel">{xen:phrase reported_items_short}:</span>
                    <span class="itemCount {xen:if '({$session.reportCounts.total} AND {$session.reportCounts.lastUpdate} > {$session.reportLastRead}) OR {$session.reportCounts.assigned}', 'alert'}" title="{xen:if $session.reportCounts.lastUpdate, '{xen:phrase last_report_update}: {xen:datetime $session.reprotCounts.lastUpdate}'}"><xen:if is="{$session.reportCounts.assigned}">{$session.reportCounts.assigned} / {$session.reportCounts.total}<xen:else />{$session.reportCounts.total}</xen:if></span>
                </a>
            </xen:if>

Keeping the {$visitor.is_moderator} causes the whole moderator bar to disappear for everyone. Removing it, makes the moderator bar re-appear for everyone but shows the report link to everyone as well.

What I want is a way to hide the report link while showing the moderator bar to everyone. In my personal opinion this is not expected behaviour, if the condition is around just the report link, why does the whole moderator bar disappear for everyone?
 
You can download the xenDisconnect style and view how I've done it. I show the moderator bar to everyone and the permissions seem to work out well. I'd post the code but not at home currently.
 
You can download the xenDisconnect style and view how I've done it. I show the moderator bar to everyone and the permissions seem to work out well. I'd post the code but not at home currently.

Please do post the code, i'll take a look at xenDisconnect but the code may help others as well.
 
They are just as they seem, content checks. They check to make sure HTML will exist, and if nothing will print out, it removes the whole thing.
 
Back
Top Bottom