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

Userfield Permissions

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

Sheldon

Well-known member
#4
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
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...
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
 

Sheldon

Well-known member
#6
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.
 

Sheldon

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

MOZ

Well-known member
#8
I'm sorry but I do not understand exactly what you want. Maybe post a screenshot of the final result (Using image editing software).
 
#10
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?
 

MOZ

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

Jake Bunce

XenForo moderator
Staff member
#12
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
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>
 
#13
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>
The code did not work:
Ekran Alıntısı.JPG

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>
You say you do not understand. Custom Field in profile by administrators only want to appear.
 

Jake Bunce

XenForo moderator
Staff member
#19
I'm writing code to the right place that you wonder if you?
View attachment 32481
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>