create revision when user cannot edit published
-
I wanted to have a user role that wouldn’t be able to publish or edit published posts/pages, but would be able to create a revision (as a draft), edit it and then submit for publishing. I thought that someone with
edit_posts
and withoutedit_published_posts
orpublish_posts
would be able to do that. But, it seem that you won’t display therevisionize
link in the admin actions on posts unless they can also edit the post directly (checks inis_create_enabled
). This seems like an odd default, since creating a revision doesn’t imply you can publish it and replace the original.So, I wanted to first confirm that this was the intended default behavior. Secondly, I wanted to provide the code we used to modify the behavior to what we were expecting, in case others had need:
add_filter('revisionize_is_create_enabled', 'hc_can_revisionize'); function hc_can_revisionize($is_enabled, $post) { if (! $is_enabled) { $is_enabled = !\Revisionize\get_revision_of($post) && current_user_can('edit_posts'); } return $is_enabled; }
- The topic ‘create revision when user cannot edit published’ is closed to new replies.