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

XF 1.5 display age in message_user_info

Discussion in 'Styling and Customization Questions' started by ungovernable, Feb 28, 2016.

  1. ungovernable

    ungovernable Member

    I'm trying to display the age in message_user_info, just next to the gender. I added this:

    Code:
            <xen:if is="@messageShowGender AND {$user.gender}">
               <dl class="pairsJustified xbGender">
                 <dt><xen:if is="@xb_fa_messageUserInfo"><i class="fa fa-user fa-fw Tooltip" title="{xen:phrase gender}" data-offsetX="-6" data-offsetY="0"></i><xen:else />{xen:phrase gender}:</xen:if></dt>
                 <dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if>
                
                 <xen:if is="{$user.show_dob_year} AND @displayUserAge">
                 , {xen:helper userage, $user} years old
                 </xen:if>
                 </dd>
               </dl>
             </xen:if>
    But it is still displaying ", years old" even if there's no age to display (i removed birthday from registration page to make it optional)
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You could add $user.dob_year to the xen:if so the code will only run if that returns anything other than null.
     
  3. ungovernable

    ungovernable Member

    Thanks ! Seems to have fixed it
     

Share This Page