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

adaaamb

Member
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:
45f3a25c8ffef5218355ecd0570c40b5.png


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


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 :)
 
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.
 
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:
f3c14b337742c710521d8909f3f6ea77.png

I also tried including the "Total" code in the if statement, but returned the same style
 
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>
 
Back
Top Bottom