Tagged: capability, lock values
- This topic has 2 replies, 3 voices, and was last updated 7 years, 6 months ago by
Steve.
-
AuthorPosts
-
-
July 24, 2014 at 4:39 am #2040
zanedickensMemberIs it possible to Lock the values of fields based on the capability of the person viewing them?
For instance one person creates, while a reviewer cannot edit but must still see the entry details.
The following tut only seems to deal with Post Status:
https://piklist.com/user-guide/tutorials/creating-meta-boxes-fields/lock-field-values-based-on-post-status/From user feedback it would be best if I used Capability, but I’m not able to find any information in the Docs as to where that is possible.
If not possible in a stable build, is it possible for me to add it in somehow?
Thanks in advance,
Zane -
July 24, 2014 at 4:45 am #2041
KevinKeymasterWe actually have it on the roadmap to roll on_post_status into conditions to allow the display to be modified like this and other ways, but that doesn’t help you now.
However, it’s possible (at least off the top of my head). Use the piklist_pre_render_field filter, which passes in $field. In your function do whatever checks you need and if you want to show the value instead of the field simply set $field[‘display’] = true and that should do the trick.
-
July 25, 2014 at 12:12 am #2061
SteveKeymaster@zanedickens– Another way is to create two meta boxes, and use the Role parameter to limit who sees them.
-Creator
-ReviewerIn the Creator meta box, create the normal Piklist Fields.
In the Reviewer meta box, pull the data (i.e. get_post_custom if a CPT), and then display the data using the Piklist HTML field.
Let us know if you need any help.
-
-
AuthorPosts
- The topic ‘Lock Fields based on Capability’ is closed to new replies.