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

XF 1.5 Conditional for Male, Female, Unspecified, Genders?

Anthony Parsons

Well-known member
#1
I want to target the gender preference default set in XF. I understand how easy this is if using custom fields, but gender already has a column in the DB, and how XF implement it within templates seems more about a call to PHP which renders the specifics vs a conditional.

So is there a way to take whatever XF has set in default, to create a conditional that can target whether the user has selected, Male, Female or Unspecified, within a template?

I want to get rid of avatars, but use the profile gender selection to replace the avatar with a coloured block, without calling an image.
 

DL6

Well-known member
#2
Hello, you can try with {$user.gender}
Code:
<xen:if is="{$user.gender} == 'male'">
    Male
<xen:elseif is="{$user.gender} ==  'female'"/>
   Female
<xen:else/>
    unspecified
</xen:if>