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

XF 1.4 When no reports, remove 0 bubble - styling issue

#1
Hey,

I'm wanting the "0" in the Report Count to be removed when there's no reports. I followed this thread: https://xenforo.com/community/threads/remove-zero-count-in-moderator-bar.29082/ - which works, but removes styling from the bubble when there's a report. I'm using a theme.

This is what it should look like:


This is what it looks like when I add <xen:if is="{$session.moderationCounts.total} !=0">


It's okay, but it doesn't really catch your eye and let you know that there's a report. I wanted to remove the bubble when there's no reports, because my theme always shows the red bubble, even when there's 0 reports.

This is my full code:
Code:
<xen:if is="{$session.moderationCounts.total} !=0"><strong 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.reportCounts.lastUpdate}'}"></xen:if>
I've tried changing it to a span and moving the if statement around, but I can't get the itemCount styling to stay visible.

Any help appreciated :)
 

Brogan

XenForo moderator
Staff member
#2
Try this:
Code:
<xen:if is="{$session.reportCounts.total}">
    <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.reportCounts.lastUpdate}'}"><xen:if is="{$session.reportCounts.assigned}">{$session.reportCounts.assigned} / {$session.reportCounts.total}<xen:else />{$session.reportCounts.total}</xen:if></span>
</xen:if>
Untested so I can't guarantee how it will work in all scenarios.
 
#3
Try this:
Code:
<xen:if is="{$session.reportCounts.total}">
    <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.reportCounts.lastUpdate}'}"><xen:if is="{$session.reportCounts.assigned}">{$session.reportCounts.assigned} / {$session.reportCounts.total}<xen:else />{$session.reportCounts.total}</xen:if></span>
</xen:if>
Untested so I can't guarantee how it will work in all scenarios.
Now it's displaying this:

I also tried including the "Total" code in the if statement, but returned the same style
 
#5
It works on my local so it's more than likely a custom style issue.
I had a quick play with the code you provided, included the "Total" code and changed one of the the if statements and it works perfectly. Thanks!

For anyone else having this issue with their theme:
Code:
<xen:if is="{$session.reportCounts.total}">
                        <strong 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.reportCounts.lastUpdate}'}">
                   
                        <span class="Total">
                            <xen:if is="{$session.reportCounts.assigned}">
                                {$session.reportCounts.assigned} / {$session.reportCounts.total}
                            <xen:else />
                                {$session.reportCounts.total}
                            </xen:if>
                        </span>
                        <span class="arrow"></span>
                    </strong>
                    </xen:if>