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

XF 1.3 Show Custom Field to Additional Usergroup

Michael

Active member
#1
Hey guys,

I am wanting to have a custom field hidden and only showing on the Personal Details page to those in an additional usergroup. How can I go about doing this, is there a conditional for this?

@Jake Bunce (you always have a knack for conditionals :D)

Thank you.
 

Jake Bunce

XenForo moderator
Staff member
#2
Admin CP -> Appearance -> Templates -> member_view

Add red code. Specify field_id and group_id in blue:

Code:
	<xen:if is="{$customFieldsGrouped.personal}">
		<xen:foreach loop="$customFieldsGrouped.personal" value="$field">
			<xen:if is="{$field.field_id} != 'field_id' OR {xen:helper ismemberof, $user, 3}">
				<xen:include template="custom_field_view" />
			</xen:if>
		</xen:foreach>
	</xen:if>
 

Jake Bunce

XenForo moderator
Staff member
#3
Hey guys,

I am wanting to have a custom field hidden and only showing on the Personal Details page to those in an additional usergroup. How can I go about doing this, is there a conditional for this?

@Jake Bunce (you always have a knack for conditionals :D)

Thank you.
Clarify...

Showing when the logged in user is a member of a group? If so then use $visitor.

Showing when the user whose profile page it is is a member of a group? If so then use $user as in the above code.
 

Michael

Active member
#5
For multiple usergroups is it like this?

<xen:if is="{$field.field_id} != 'field_id' OR {xen:helper ismemberof, $visitor, 3, 4, 17}">
 

Jake Bunce

XenForo moderator
Staff member
#7