XF 2.2 Removing comma from output of $data.value on Notable Members page

apathy

Well-known member
I have an addon which adds a bar chart to the notable members page, and it works perfectly fine up until a user has 1000+ posts. It stops working then because the output of $data.value in this instance is "1,000" instead of "1000".

I've tried using some filters/functions to remove it but I'm not having much luck.

floor($data.value) = 1
$data.value|number = 1
$data.value|number(1) = 1.0

Is it possible at all to manipulate the output in this way through the templates, or would it require PHP?
Thanks in advance
 
The raw value should be without a comma - it is the |number filter which adds the comma.

For example, using {$user.message_count} will output 61907, but using {$user.message_count|number} will output 61,907.
 
The raw value should be without a comma - it is the |number filter which adds the comma.

For example, using {$user.message_count} will output 61907, but using {$user.message_count|number} will output 61,907.
None of my template uses |number though (I just used it to test it the issue would fix with it), and for the most part no commas show up, except for the "Most messages" block

broken_bars.png


Please note how for "Most messages", the top 2 bars are both at 100%, and that it outputs a comma whilst Top Shouters does not.

Code:
<xf:set var="$max_num" value="1" />
<xf:foreach loop="$results" key="$userId" value="$data">
    <xf:if is="$max_num < floor($data.value)">
        <xf:set var="$max_num" value="{$data.value}" />
    </xf:if>
    <li>
        <xf:set var="$percentage" value="{{ ((floor($data.value) * 100) / $max_num) }}" />
        <div class="contentRow contentRow--alignMiddle" style="height:40px">
            <div class="contentRow-figure">
                <xf:avatar user="$data.user" size="xs" />
            </div>

            <div class="contentRow-main" style="display:inline-block;position:relative;">
                <div style="margin-top:-5px !important;width:{{$percentage}}%;height:40px;position:absolute;background:{{ property('ap_bar_color') }};z-index:0;"></div>
                <xf:if is="$data.value">
                    <div class="contentRow-extra contentRow-extra--large" style="position:relative;z-index:1;">{$data.value}</div>
                </xf:if>
                <h3 class="contentRow-title" style="position:relative;padding-left:4px;padding-top:5px;z-index:1;"><xf:username user="$data.user" rich="true" /></h3>
            </div>
        </div>
    </li>
</xf:foreach>
 
Top Bottom