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

XF 1.3 $user.customFields.xyz - in the header?

Discussion in 'Styling and Customization Questions' started by Sage Knight, Jun 26, 2014.

  1. Sage Knight

    Sage Knight Well-Known Member

    Is there anyway to display $user custom fields in the header template, using helpers or anything? $visitors is working but not the former.
     
    Last edited: Jun 26, 2014
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You've got the right idea.

    $visitor is for the current logged in user. Is that your intention? Whose profile field do you want to display where? And on what page?
     
  3. Sage Knight

    Sage Knight Well-Known Member

    The detail will still be displayed on the profile page but I do not want to use member_view as it's not given me the freedom I want (pageContainer is coming in the way..)

    I'm using a conditional to make it display only in the member_view page. And I want to fetch the custom field for each member (i.e $user and not $visitor) and have it uniquely displayed on their profiles rather than the logged in visitor's field and to accomplish this I want to add the custom field ($user) in the header template and use another conditional to only make it appear in the member_view content template (for maximum freedom as mentioned).
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Add this to the top of the member_view template:

    Code:
    <xen:container var="$memberViewField">{$user.customFields.multialpha}</xen:container>
    
    That will pass the value you need into the container scope. Now you can use this in PAGE_CONTAINER:

    Code:
    {$memberViewField}
    
     
    Sage Knight likes this.
  5. Sage Knight

    Sage Knight Well-Known Member

    I tried it and it works, much appreciated!!
     

Share This Page