• 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?

Sage Knight

Well-known member
#1
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:

Jake Bunce

XenForo moderator
Staff member
#2
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?
 

Sage Knight

Well-known member
#3
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?
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).
 

Jake Bunce

XenForo moderator
Staff member
#4
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

Well-known member
#5
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}
I tried it and it works, much appreciated!!