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

Userfield Permissions

Discussion in 'XenForo Questions and Support' started by Mostruoso, Aug 4, 2012.

  1. Mostruoso

    Mostruoso Member

    Hello,

    My speak english is a little, sorry.

    I opened a special and not just for members userfields I want to see administrator.

    I've tried to display the HTML code below but did not work out! :(

    <xen:if is="{$visitor.is_admin}">{$value}</xen:if>
    Your suggestions on what? Please help.


    Ekran Alıntısı.JPG
     
  2. Dinh Thanh

    Dinh Thanh Well-Known Member

    Don't understand yet.
    Is this in your add-on or a template, what is $value?
     
  3. Mostruoso

    Mostruoso Member

  4. Sheldon

    Sheldon Well-Known Member

    In the value area, I think you are needing to place a "1", as that is the value (default) the administrator usergroup.

    I think that is what you are asking...
     
  5. Mostruoso

    Mostruoso Member

    I would like to see not only the administrator group members userfield area was opened, and what can I do for it. this is the question
     
  6. Sheldon

    Sheldon Well-Known Member

    I am having a hard time understanding.

    If you are wanting everyone to have a custom userfield, simply create one. Make it visible and editable.

    If you are wanting everyone to have the ability to "create" their own custom userfields, I don't think that is possible without some type of add-on.
     
  7. Sheldon

    Sheldon Well-Known Member

    The picture you reference above is in the AdminCP, other users will not be able to see that. However, when you select the area to show, if they go into their "preferences" and whatever area you set it as, they will be able to fill in that slot with what you are asking for.
     
  8. MOZ

    MOZ Well-Known Member

    I'm sorry but I do not understand exactly what you want. Maybe post a screenshot of the final result (Using image editing software).
     
  9. Mostruoso

    Mostruoso Member

    Hmm, one minute.
     
  10. Mostruoso

    Mostruoso Member

    What I mean is, I created a userfield in which the users will input their full names. And only the administrator is able to see this userfield.

    I need a code for that style I wanted you?
     
  11. MOZ

    MOZ Well-Known Member

    This is what you have to do:

    1. Create field, with a specific ID, eg name.
    2. Choose Nodes and Permissions, select which usergroups can use the field and in which nodes.
    3. Then navigate to Node Tree -> Node in which field name is acitvated
    4. Choose Custom Thread Fields tab and in Header Template HTML or Footer Template HTML, add the following
    Code:
    <xen:if is="{$visitor.is_admin}">{$customFields.name}</xen:if>
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I don't follow this.

    This is the correct condition to display something only for the admin:

    Code:
    <xen:if is="{$visitor.is_admin}">
    ...
    </xen:if>
    
    Then the question becomes, where do you want to display the custom field? In posts? In profiles? For example, edit this template to make the field show in posts:

    Admin CP -> Appearance -> Templates -> message_user_info

    You can use this code:

    Code:
    <xen:if is="{$visitor.is_admin}">
    	{$user.customFields.field_id}
    </xen:if>
    
     
    0xym0r0n likes this.
  13. Mostruoso

    Mostruoso Member

    The code did not work:
    Ekran Alıntısı.JPG

    You say you do not understand. Custom Field in profile by administrators only want to appear.
     
  14. MOZ

    MOZ Well-Known Member

  15. Mostruoso

    Mostruoso Member

  16. MOZ

    MOZ Well-Known Member

    Please do not, that addon does something absolutely different.
     
  17. Mostruoso

    Mostruoso Member

  18. Mostruoso

    Mostruoso Member

    I'm writing code to the right place that you wonder if you?
    Ekran Alıntısı.JPG
     
  19. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That won't work. Remove the code from that box.

    Ok that is the profile page. Edit this template:

    Admin CP -> Appearance -> Templates -> member_view

    Add the red code:

    Code:
    				<xen:if hascontent="true">
    					<div class="section">
    						<h3 class="textHeading">{xen:phrase about}</h3>
    
    						<div class="secondaryContent">
    							<xen:contentcheck>
    								<xen:if hascontent="true">
    									<div class="pairsColumns aboutPairs">
    									<xen:contentcheck>
    										<xen:if is="{$user.gender}">
    											<dl><dt>{xen:phrase gender}:</dt> <dd><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if></dd></dl>
    										</xen:if>
    
    										<xen:if is="{$birthday}">
    											<dl><dt>{xen:phrase birthday}:</dt> <dd>{xen:date $birthday.timeStamp, $birthday.format} <xen:if is="{$birthday.age}">({xen:phrase age}: {xen:number $birthday.age})</xen:if></dd></dl>
    										</xen:if>
    
    										<xen:if is="{$user.homepage}">
    											<dl><dt>{xen:phrase home_page}:</dt> <dd><a href="{xen:string censor, $user.homepage, 'x'}" rel="nofollow" target="_blank">{xen:string censor, $user.homepage}</a></dd></dl>
    										</xen:if>
    
    										<xen:if is="{$user.location}">
    											<dl><dt>{xen:phrase location}:</dt> <dd>{xen:string censor, $user.location}</dd></dl>
    										</xen:if>
    
    										<xen:if is="{$user.occupation}">
    											<dl><dt>{xen:phrase occupation}:</dt> <dd>{xen:string censor, $user.occupation}</dd></dl>
    										</xen:if>
    										
    										<xen:if is="{$customFieldsGrouped.personal}">
    											<xen:foreach loop="$customFieldsGrouped.personal" value="$field">
    											<xen:if is="{$field.field_id} != 'field_id of restricted field' OR {$visitor.is_admin}">
    												<xen:include template="custom_field_view" />
    											</xen:if>
    											</xen:foreach>
    										</xen:if>
    									</xen:contentcheck>
    									</div>
    								</xen:if>
    
    								<xen:if is="{$user.about}"><div class="baseHtml ugc">{xen:raw $user.aboutHtml}</div></xen:if>
    							</xen:contentcheck>
    						</div>
    					</div>
    				</xen:if>
    
     
    Mostruoso likes this.
  20. Mostruoso

    Mostruoso Member

    Thank you @Jake.
    Edit: How can I do for Two Custom Field?
     

Share This Page