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

XF 1.2 Custom User Field - Only for admin to view

#1
How to make custome user fields that can be viewed in user profile only by admins, but usual users cannot see it.

For example for support forum of software it essential to fast check of user license.
 

Mike

XenForo developer
Staff member
#2
You would want to make the field not user editable (or editable only once if you want them to fill it in initially). Make sure it's not selected to show up in messages or on the profile page as well.

If it still must be displayed in the front end, you'd need to customize the appropriate templates to display it in specific conditions.
 
#6
Just to add a small question to this as I want to achieve the same.

I'm having members enter their personal data but of course that should only be visible to other members of the group, not to other ones.
So I'd like to somehow define which groups are able to view a certain custom user field.

Do I need an addon for this or would it become manual template edits?
 
#7
mine case
Code:
<xen:if is="{$visitor.is_admin}">
<xen:if hascontent="true">
    {xen:helper userFieldTitle, my_identifier}:
    <xen:contentcheck>
        {xen:helper userFieldValue, $userFieldsInfo.my_identifier, $user, {$user.customFields.my_identifier}}
    </xen:contentcheck>
</xen:if>
</xen:if>
replace my_identifier with custom field

Ladergo
Code:
<xen:if is="{xen:helper ismemberof, $visitor, x}">
<xen:if hascontent="true">
    {xen:helper userFieldTitle, my_identifier}:
    <xen:contentcheck>
        {xen:helper userFieldValue, $userFieldsInfo.my_identifier, $user, {$user.customFields.my_identifier}}
    </xen:contentcheck>
</xen:if>
</xen:if>
user group x
 
#8
And to which template should this be added? Preferably I'd make this a configurable option in admin panel but I suppose that's a bit too much to ask right ;-)