<p>There isn't anything to do this out-of-the-box in Craft.</p>

<p>I believe the proper way you'd want to approach it would be to write a <a href="http://buildwithcraft.com/docs/plugins/introduction" rel="nofollow">plugin</a> that has it's own <a href="http://buildwithcraft.com/docs/plugins/field-types" rel="nofollow">field type</a> that takes into account user permissions.</p>

<p>An admin would get a normal text input, for example, and any other user would just see read-only text.</p>

CC BY-SA 3.0
2014-07-24T20:32:29.447Z
Thanks for the reply, once that is done how would one hide or replace the "my account" link in the cp?
pythic
CC BY-SA 3.0
2014-07-24T21:06:07.263Z
Maybe with a little CSS/JS? http://straightupcraft.com/craft-plugins/control-panel-css
Brad Bell
CC BY-SA 3.0
2014-07-21T19:25:45.783Z
2014-07-21T19:25:45.783Z
Brad Bell
<p>I did not have a lot of time to find a solution for this so I used a workaround maybe that can work for your case as well.</p>

<p>So firstly my case was such that I needed to have an entries field type that only the admin can edit for each user. It was NOT important in my case for the user (For whom the field is being edited) to see which entries are attached to his field in the backend control panel. I could show it to them in the front end. Hence what I did was I modified the entries fieldtype form template (Which is located at craft/app/templates/_includes/forms/elementSelect.html) and added two if statements. Firstly I added an if statement to check the name of the field and then another if to show or hide the add entry button. Hence if my entry name is userSubscriptions then the html looked as follows:</p>

<pre><code>{% if name == 'userSubscriptions' %}
    {% if currentUser == 'admin' %}
        &lt;div class="btn add icon dashed"&gt;{{ addButtonLabel }}&lt;/div&gt;
    {% endif %}
{% else %}
    &lt;div class="btn add icon dashed"&gt;{{ addButtonLabel }}&lt;/div&gt;
{% endif %}
</code></pre>

<p>But obviously this is not the best way of doing it. Its just a temporary solution if you really need to do it fast. Im not sure if this could work with your fieldtype as well but thats my take on it. I will keep trying to find the correct way of doing this and if I manage to do it Ill let you know and if you manage to do it the other way then let me know how you did it. Thanks</p>

CC BY-SA 3.0
2014-10-20T02:30:28.727Z
2014-10-20T02:30:28.727Z
Moin Qidwai
<p>You could use <strong>disabled</strong> to prevent people from filling it except the admin:</p>

<pre><code>    {% if currentUser == 'admin' %}
      &lt;input type="text" name="email" value="{{currentUser.username}}"&gt;
    {% else %}
      &lt;input type="text" name="email" value="{{currentUser.username}}" disabled&gt;
    {% endif %}
</code></pre>

<p>The field still get's filled but users are prevented from writing anything on it. Hope this is what you were after.</p>

CC BY-SA 4.0
2020-05-24T14:52:12.920Z
Note that this would still allow users to send requests to user edit controller, they would just not have interface available.
Piotr Pogorzelski
CC BY-SA 3.0
2014-12-29T16:57:26.923Z
2014-12-29T16:57:26.923Z
Vitor
<p>Is there a way to prevent the current user from changing fields in his profile? Currently i've attached a customfield "company" to the user object. I only want the site admin to set this field once and the only one allowed to change this. Where can I inject/override/overload the behavior of the saveUser method? Or is there a way to allow a different validation function or to disable a certain customfield during edit/save?</p>

<p>Thanks in advance.... ﻿</p>

CC BY-SA 3.0
2014-10-16T11:01:36.823Z
Hey pythic were you able to solve this issue? I am having a similar problem and could use some help.
Moin Qidwai
CC BY-SA 3.0
2014-10-18T12:02:28.200Z
Moin, its still on my todo list. I'll keep you posted once this is fixed. If you have a solution let me know... Thanks
pythic
<user-profile>
Prevent change field in user profile edit
# Prevent change field in user profile edit

(Asked by: username_0 on 2014-07-21)

Is there a way to prevent the current user from changing fields in his profile? Currently i've attached a customfield "company" to the user object. I only want the site admin to set this field once and the only one allowed to change this. Where can I inject/override/overload the behavior of the saveUser method? Or is there a way to allow a different validation function or to disable a certain customfield during edit/save?

Thanks in advance.... ﻿

**Tags:** user-profile
> **Comments:**
> **username_1**: Hey pythic were you able to solve this issue? I am having a similar problem and could use some help.  
> **username_0**: Moin, its still on my todo list. I'll keep you posted once this is fixed. If you have a solution let me know... Thanks  

---

## 3 answers

### Answer by username_2 on 2014-07-21. Score: 3

There isn't anything to do this out-of-the-box in Craft.

I believe the proper way you'd want to approach it would be to write a [plugin](http://buildwithcraft.com/docs/plugins/introduction) that has it's own [field type](http://buildwithcraft.com/docs/plugins/field-types) that takes into account user permissions.

An admin would get a normal text input, for example, and any other user would just see read-only text.

> **Comments:**
> **username_0**: Thanks for the reply, once that is done how would one hide or replace the "my account" link in the cp?  
> **username_2**: Maybe with a little CSS/JS? http://straightupcraft.com/craft-plugins/control-panel-css  

---

### Answer by username_1 on 2014-10-20. Score: 2

I did not have a lot of time to find a solution for this so I used a workaround maybe that can work for your case as well.
So firstly my case was such that I needed to have an entries field type that only the admin can edit for each user. It was NOT important in my case for the user (For whom the field is being edited) to see which entries are attached to his field in the backend control panel. I could show it to them in the front end. Hence what I did was I modified the entries fieldtype form template (Which is located at craft/app/templates/_includes/forms/elementSelect.html) and added two if statements. Firstly I added an if statement to check the name of the field and then another if to show or hide the add entry button. Hence if my entry name is userSubscriptions then the html looked as follows:
{% if name == 'userSubscriptions' %}
    {% if currentUser == 'admin' %}
        {{ addButtonLabel }}
    {% endif %}
{% else %}
    {{ addButtonLabel }}
{% endif %}

But obviously this is not the best way of doing it. Its just a temporary solution if you really need to do it fast. Im not sure if this could work with your fieldtype as well but thats my take on it. I will keep trying to find the correct way of doing this and if I manage to do it Ill let you know and if you manage to do it the other way then let me know how you did it. Thanks


---

### Answer by username_3 on 2014-12-29. Score: 2

You could use disabled to prevent people from filling it except the admin:
    {% if currentUser == 'admin' %}
      
    {% else %}
      
    {% endif %}

The field still get's filled but users are prevented from writing anything on it. Hope this is what you were after.

> **Comments:**
> **username_4**: Note that this would still allow users to send requests to user edit controller, they would just not have interface available.  

---

