1. 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

Discussion in 'XenForo Questions and Support' started by Michael, May 6, 2014.

  1. Michael

    Michael Active Member

    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.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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>
    
     
    Michael likes this.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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 likes this.
  4. Michael

    Michael Active Member

    Thanks Jake, thats right I wanted it to only show when the logged in user is a member of a specific group.
     
  5. Michael

    Michael Active Member

    For multiple usergroups is it like this?

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

    Michael Active Member

    Hey Jake I have just realised when going to implement this that you are talking about member_view, I am wanting to hide specific custom fields and show them only to those I want to be able to fill them in for example usergroup ID 9 I want able to see the custom fields on this page:

    http://xenforo.com/community/account/personal-details

    :)
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Michael likes this.
  8. Michael

    Michael Active Member

Share This Page