Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #6028
      jrcreative
      Member

      I see that I can easily hide fields based on capability, and I can lock fields based on post status, but is it possible to lock a field value based on capability?

      Thanks in advance.

    • #6048
      Steve
      Keymaster

      One of the best parts of Piklist is that it’s code based so you can do anything you can think of.

      In this situation you can just use the standard HTML INPUT attribute READONLY. Add this to your field to make a field readonly if the user can’t manage_options:

      ,'attributes' => array(
        'readonly' => !current_user_can('manage_options') ? 'readonly' : ''
      )
      
    • #6085
      jrcreative
      Member

      Awesome! I didn’t realize that ‘attributes’ was open to any html attribute, I thought it was limited to some proprietary Piklist attributes.

    • #6086
      Steve
      Keymaster

      You can pass ANY standard HTML attribute(s) you want.

Viewing 3 reply threads
  • The topic ‘Lock field based on capability’ is closed to new replies.