Displaying custom userfield only when filled

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
655
Points
103

Reputation:

Hey,

I want to display a custom userfield in my member_view template.

Code:
{$user.Profile.custom_fields.discordinfo}

How exactly do I write the function to only show the userfield when someone filled it?
Because currently it's always displayed, even tho the user hasn't filled it.

Template Modification
HTML:
<div class="trow1 x-smalltext d-flex align-items-center">
                                Discord:
                                <span class="ml-auto">{$user.Profile.custom_fields.discordinfo}</span>
                            </div>

Edit: I am actually stupid, forgot about the content check. Works now.

HTML:
                                <xf:if contentcheck="true">
                                <div class="trow1 x-smalltext d-flex align-items-center">
                                Discord:
                                    <span class="ml-auto"><xf:contentcheck>{$user.Profile.custom_fields.discordinfo}</xf:contentcheck></span>      
                            </div>
 
Last edited:
Top