• I have made a custom permission “flamingo” using the User Role Editor plugin. I have also removed the map_meta_cap filter and added a custom one, like this:

    remove_filter( 'map_meta_cap', 'flamingo_map_meta_cap' );
    add_filter( 'map_meta_cap', 'mycustom_flamingo_map_meta_cap', 9, 4 );
    function mycustom_flamingo_map_meta_cap( $caps, $cap, $user_id, $args ) {
        $meta_caps = array(
           'flamingo_edit_inbound_message' => 'flamingo',
           'flamingo_edit_inbound_messages' => 'flamingo',
           'flamingo_delete_inbound_message' => 'flamingo',
           'flamingo_delete_inbound_messages' => 'flamingo',
           'flamingo_spam_inbound_message' => 'flamingo',
           'flamingo_unspam_inbound_message' => 'flamingo',
           'flamingo_edit_outbound_message' => 'flamingo',
           'flamingo_edit_outbound_messages' => 'flamingo',
           'flamingo_delete_outbound_message' => 'flamingo',
    );
    
    $caps = array_diff( $caps, array_keys( $meta_caps ) );
    if ( isset( $meta_caps[$cap] ) )
        $caps[] = $meta_caps[$cap];
        return $caps;
    }

    Users that have “flamingo” permission can view all inbound messages, but I want them also to be editable. Is this possible? Not sure if I’m doing something wrong or if maby I’m asking about a feature that not exists.

    Thanks in advance for helping me.

The topic ‘Can form data be editable?’ is closed to new replies.