• Resolved bengriff64

    (@bengriff64)


    Hi,

    What a great plugin this is. I have my form loading in the data to a custom post type which is great, but can I change the settings so that the values are read only and an admin cannot edit?

    I am creating a job board and don’t want an admin to be able to edit the fields of a form submission. Any help would be greatly appreciated.

Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback! I’m glad you enjoy ACF Extended ??

    Readonly/disabled fields is a hot topic, it is a setting which is repeatedly asked by users on the official ACF support forum. However, it’s kind of tough to find the perfect solution for every fields (especially the complex one like repeater, flexible content, groups etc…). That’s probably why a global solution hasn’t been implemented yet.

    Some fields (most of basic fields) support disabled = true, which is a setting which can be added using a hook like:

    
    add_filter('acf/prepare_field/name=my_field', 'my_acf_disabled_field');
    function my_acf_disabled_field($field){
    
        // Admin only
        if(is_admin()){
            $field['disabled'] = true;
        }
    
        return $field;
    
    }
    

    It is also possible to set field as disabled in the adminstration from the UI, using the Advanced Fields Settings in your field group. Once activated (and once the field group has been saved with this setting enabled), you’ll able to set a custom setting based on the current screen for each field.

    In this example, I’ve set “Disabled = true” when in the administration: https://imgur.com/a/ygRM1E3

    Again, it won’t work for all fields, but for the basic one it will. I’m thinking about a global solution for a future patch, but nothing is ready yet.

    One last solution is to not show the field group in the administration, but instead, display a “Dynamic Message” field, and use PHP code to display all fields values in text only (using get_field('my_field')). Please check the “Dynamic Message” part of the readme to learn more about this field.

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Read only post’ is closed to new replies.