In a current project I need to be able to restrict access to posts by comparing the post's language against the languages a user has access to. This, I'm certain I can achieve.
However, even if a user should not be allowed to edit the post the user should be able to view the post in the administration area. The reason for this is to be able to use the localization plugin's duplicate/translate actions. And also so the user can just compare information or read from another language.
The problem now is that the cap I'm interested in (edit_post
) is used both to access the edit page and also to the actual saving of the post.
When using one of the filters map_meta_cap or user_has_cap no real context is passed except the post ID. So I can't really prevent just the post save while allowing the edit page to still be accessible.
Is there a way to allow a role to access/view an edit post page in the administration and still disallow actual save actions?
I would prefer not to try to figure out the context by going through the backtrace with debug_backtrace()
.