Want to show Related post field readonly for some user roles
In the backend that's only possible with pure custom code.
In the Front End as display a read-only would not make any sense as displays are not inputs.
So in the Front end generally this could only affect Toolset Forms, where you can hide/show (but not make read only) inputs based on conditions such as a user role.
So you could display the value of the field to the user role of no rights, and display the input of the field to the users with right, in a Toolset Form.
However without custom code, this is not possible in the backend and not possible as "readonly" (the proper HTMl attribute of inputs) in the front end like that.
Toolset forms indeed supports a "readonly" argument for it's inputs, but I am not sure you will be happy with that as A) it's in the front end and B) it is the "readonly" as explained here https://stackoverflow.com/questions/7730695/whats-the-difference-between-disabled-disabled-and-readonly-readonly-for-ht
(So, it's just not editable, but can be submitted, whereas a disabled input also would be not submitted).
If any of the above solutions do not match your requirements, a possibility is to ask the Product Management to add this as a feature throughout Toolset, or we can look after eventual other approaches so you can achieve the same goal, with different methods?
Hi Beda,
My requirement is that one of my user role job_author for that i have created two select dropdowns 1. Related Job Template (custom post list) and 2. Related Hospital (Custom Post) which is select by admin when creating a user.
once user type job_author created I give access to add job from admin no any other access but in the job post, I have 2 fields which are a type of Related Posts both are the same as used in user add 1. Related Job Template (custom post list) and 2. Related Hospital (Custom Post) so when particular job_author login and create job post by default make it selected which select in user_meta at the time create a user and save in post_meta when saving job post.
These are my requirements can you tell me the best option for this?
Thanks
This is in the backend, I understand.
It is not possible to make Custom Post-Fields readonly conditionally to user roles, in the backend, using Toolset.
You could do that with Custom Code, but the Toolset Support could not help with such code, as it's above the features or API's that Toolset offers.
You could include this as a request to https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
You could try to use Toolset Access - the plugin handling who can do and see what - it does offer controls over post fields.
https://toolset.com/documentation/user-guides/access-control-for-user-fields/
So you can make a field editable, or just visible but not editable.
This is not exactly setting a manual "readonly", but it covers the same feature.
Does that help?
Hi Beda,
Access Plugin use for the user but i want to make read-only for post fields and this all post fields I am using in Filter for the post so please provide a solution if you have.
Thanks
You can use Toolset Access Plugins to hide a Custom Post Field from a Certain user role.
Head to Toolset > Access > Custom Fields and apply read or edit permission to the field for the user or role you wish.
That is the solution for the question how to make it so that users of a role cannot edit a certain custom post field.
I have provided this above already in my previous reply.
You mention a filter, that would be a Search in the front end?
Or what filter do you mean?
Hi Beda,
Thank you for explain
You mention a filter, that would be a Search in the front end?
Or what filter do you mean? - Yes Search in Front End
Let me check by Toolset Access and let you know if any help require.
Thanks
In the Front end, Toolset Access will not allow to make readonly the SEARCH input of a View.
This cannot be done with Toolset.
If you need a Search input that is visible, but cannot be chosen, or if chosen, produces no results, you'd need to apply custom coded search inputs for each user.
Or you could use custom inputs of values, and correct the values you do not want the users to get results of with a invalid value.
But this is not what you described initially, where it is about editing the fields in the posts.
I think you will be able to solve your goal with the Access plugin, if this is about the backend editing of a post.
For a front end search you'll need at least Custom HTML to achieve this, within some Conditional HTML checking on the user, for example, or even producing several different Views for several user roles.
Hi Beda
I have many fields for a particular post type but I want to make read-only field which is the type of Post Reference so how can I give using access plugin I have already installed
or please make the next reply private so I give credentials of admin and post detail and field detail so you can check and give guidance.
Thanks
I explained here how you can make a field to be editable, or only visible with Toolset Access:
https://toolset.com/forums/topic/want-to-show-related-post-field-readonly-for-some-user-roles/#post-1354781
I see I made a mistake, instead of Custom Fields, it's Types fields.
Here step by step:
1. Create a Custom Field Group and put your fields that you want to control with Access in it.
2. Head to Toolset > Access Control > Types Fields > Your Custom Field Group
3. Set the permissions for that Custom Field Group as you need.
In the screenshot you can see this for a WooCommerce Fields Group I made but it can be any group you made.
SINGLE Fields cannot be controlled, only the entire group.
So if you need one ONE field hidden or visible but not editable, you need to put that Field in a separate Field Group.
I've activated a private reply, but I cannot implement this for you, our Support Policy does not cover such development.
I can however show you an example, create one, on a staging site for example.
Then, using that example, you can build your own adapted case.