Viewing 2 reply threads
  • Author
    Posts
    • #2040
      zanedickens
      Member

      Is 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

    • #2041
      Kevin
      Keymaster

      We 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.

    • #2061
      Steve
      Keymaster

      @zanedickens– Another way is to create two meta boxes, and use the Role parameter to limit who sees them.
      -Creator
      -Reviewer

      In 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.

Viewing 2 reply threads
  • The topic ‘Lock Fields based on Capability’ is closed to new replies.