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

Remove Zero Count in Moderator Bar?

Discussion in 'Styling and Customization Questions' started by DRE, Mar 10, 2012.

  1. DRE

    DRE Well-Known Member

    How do you remove the zeros when there is nothing in Reported Items or Moderation Queue?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Editing the moderator_bar template and adding something like <xen:if is="{$session.moderationCounts.total} !=0"> should do it.
     
    The8thLegion likes this.
  3. DRE

    DRE Well-Known Member

    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!
     
    Trombones13 likes this.
  4. DRE

    DRE Well-Known Member

    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.
     
  5. Trombones13

    Trombones13 Well-Known Member

    I think moving your <xen:if> conditional in front of each "itemCount" line should do the trick.
    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.)
     
    The8thLegion likes this.
  6. DRE

    DRE Well-Known Member

    No extra </a>
    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
     

Share This Page