Skip Navigation

[Resolved] Set visibility to custom type fields by user roles

This thread is resolved. Here is a description of the problem and solution.

Problem:

Display different content for different user role.

Solution:

I suggest you try with Toolset Access shortcode [toolset_access] shortcode to display those custom fields, for example:

[toolset_access role="Administrator,Editor" operator="allow"]
Here display the custom fields
[/toolset_access]

Relevant Documentation:

https://toolset.com/documentation/user-guides/access-control/access-control-texts-inside-page-content/

This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by maioraL 4 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1600945

I made a Frontend form to post a custom post type: hidden link

But i need some fileds visible only for some user roles during the creation of post and some other visible in read-only.

I try with Access addon but fields still remain visible for all roles.

Can you help me pls?
Tnx a lot

#1602059

Hello,

I suggest you try with Toolset Access shortcode [toolset_access] shortcode to display those custom fields, for example:

[toolset_access role="Administrator,Editor" operator="allow"]
Here display the custom fields
[/toolset_access]

More help:
Access Control for Contents Inside Page Content
https://toolset.com/documentation/user-guides/access-control/access-control-texts-inside-page-content/

#1603161

Tnx a lot for help, works fine.....
but this trick create other problem.

I set access permission only for a specific user roles on a form field correctly.

When user with a different role try to add a new post by this frontend form doesn't see the field but when save the default value of this field is not stored.

how i can hide for a specific role a field (like you suggest me above with Access) but when form are sent, save the value anyway?

Tnx a lot

#1603197
User Dashboard – Youxta.jpg

I integrate the previous post with a screenshot.

As you can see the field in views still appear empty when post saved from a user.

The second row have filed filled because i have edited it in backend and saved again.

Tnx a lot for help

#1603455

How do you setup the default value of that custom field?
If that custom field is created with Toolset Types plugin, you can edit that custom field, in option "Default Value", setup the Default Value, see screenshot:
https://toolset.com/wp-content/uploads/2011/10/field-details.jpg

More help:
https://toolset.com/documentation/user-guides/custom-content/using-custom-fields/

#1603779
Modifica gruppo ‹ Youxta — WordPress.jpg

Hi Luo, good morning.

As you can see on the new attacched screenshot i set a default value for my "Select" type field....
but is not saved when frontend form was submitted 🙁

Where is the mistake?

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/save-the-default-value-of-this-field-is-not-stored/

#1603833

I assume the original question of this thread is resolved, according to our support policy, we prefer one question one ticket, for the new question, please check the new thread here:
https://toolset.com/forums/topic/save-the-default-value-of-this-field-is-not-stored/

#1605465

My issue is resolved now. Thank you!