Remove Zero Count in Moderator Bar?

DRE

Well-known member
How do you remove the zeros when there is nothing in Reported Items or Moderation Queue?
 
Editing the moderator_bar template and adding something like <xen:if is="{$session.moderationCounts.total} !=0"> should do it.
Okay thanks man! It was both moderationCounts and reportcounts I needed. Looks like this now:

Code:
<xen:if is="{$session.moderationCounts.total} !=0">
            <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></xen:if></a></xen:if>
<xen:if is="{$session.reportCounts.total} !=0">                
                <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>

Works great!
 
Woops. My code above does not remove the zero count, but removes the entire link.

Oh well I was getting tired of looking at it when there were no items reported anyway.
 
I think moving your <xen:if> conditional in front of each "itemCount" line should do the trick.
Rich (BB code):
<xen:if is="{$visitor.is_moderator}">
                <a href="{xen:link moderation-queue}" class="moderationQueue modLink">
                    <span class="itemLabel">{xen:phrase moderation_queue}:</span>
                  <xen:if is="{$session.moderationCounts.total} !=0"> <span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span></xen:if>
</a></xen:if></a>
(Also, I think you have an extra </a> tag in there.)
 
I think moving your <xen:if> conditional in front of each "itemCount" line should do the trick.
Rich (BB code):
<xen:if is="{$visitor.is_moderator}">
                <a href="{xen:link moderation-queue}" class="moderationQueue modLink">
                    <span class="itemLabel">{xen:phrase moderation_queue}:</span>
                  <xen:if is="{$session.moderationCounts.total} !=0"> <span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span></xen:if>
</a></xen:if></a>
(Also, I think you have an extra </a> tag in there.)
No extra </a>
I think moving your <xen:if> conditional in front of each "itemCount" line should do the trick.
Rich (BB code):
<xen:if is="{$visitor.is_moderator}">
                <a href="{xen:link moderation-queue}" class="moderationQueue modLink">
                    <span class="itemLabel">{xen:phrase moderation_queue}:</span>
                  <xen:if is="{$session.moderationCounts.total} !=0"> <span class="itemCount {xen:if {$session.moderationCounts.total}, 'alert'}">{$session.moderationCounts.total}</span></xen:if>
</a></xen:if></a>
(Also, I think you have an extra </a> tag in there.)
Yup. Was gonna do that but changed my mind since I filled up the bar with some links from this edit: http://xenforo.com/community/resources/moving-visitor-tabs-to-the-moderator-bar.470/ Took away the extra </a> thanks
 
Top Bottom