bu-versions
bu-versions copied to clipboard
Custom post_type with custom capabilities
Hi! I found an issue on my custom post type with custom capabilities such as:
` 'capability_type' => 'events', 'capabilities' => array( // Meta capabilities 'edit_post' => 'event_edit', 'read_post' => 'event_read', 'delete_post' => 'event_delete',
// Primitive capabilities used outside of map_meta_cap():
'edit_posts' => 'events_edit',
'edit_others_posts' => 'events_edit_others',
'publish_posts' => 'events_publish',
'read_private_posts' => 'events_read_private',
// Primitive capabilities used within map_meta_cap():
'read' => 'read',
'delete_posts' => 'events_delete',
'delete_private_posts' => 'events_delete_private',
'delete_published_posts' => 'events_delete_published',
'delete_others_posts' => 'events_delete_others',
'edit_private_posts' => 'events_edit_private',
'edit_published_posts' => 'events_edit_published',
'create' => 'events_edit',
),`
Those custom capabilities are not being copied to the alternate post and if an user without the default edit_post cap won't be able to view or edit the alternate version.
I managed to fix the issue by adding the following line on the line 414 of bu-versions.php:
$args['cap'] = $type->cap;
I don't know if it will have any impact in your design but if not maybe you could include this update in your next version?
Best regards,