XF 2.1 User custom field: print choice instead of value

Azaly

Active member
Hello! Need help with user custom fields 😭. I try to show it in member tooltip, but just don't know how to show {$choice} value instead of {$value} .

This shows only {$value} :
Code:
                <xf:if contentcheck="true">
                    <div class="memberTooltip-blurb">
                    <xf:contentcheck>
                        <xf:userblurb user="$user" tag="div" />
                <xf:if is="$user.Profile.custom_fields.varr">
                    <span class="userTitle" dir="auto">$user.Profile.custom_fields.varr</span> 
                </xf:if>
                    </xf:contentcheck>
                    </div>
                </xf:if>
I've also tried {$user.Profile.custom_fields.getFormattedValue('varr')} with same result.

Value display HTML is set to {$choice} in User » Custom field » Edit field options.
 
Answer to myself if someone would searching something like this. Just add "|raw" and it works like a charm:
Code:
        <xf:if contentcheck="true">
            <xf:contentcheck>
                <xf:if is="$user.Profile.custom_fields.gender">
                    {$user.Profile.custom_fields..getFormattedValue('gender')|raw}
                </xf:if>
            </xf:contentcheck>
        </xf:if>
 
Last edited:
Hello,

I have custom field ID as ABC. And there are choices under ABC

Custom user field IDABC
1. valueX1
2. valueX2
3. valueX3
4. valueXr

I want to show icon depends on 1,2,3,4 values separately. How can I do that? Do you have any idea?

Thanks for your help in advance.
 
Top Bottom