Does your custom post type definition have any settings for
capability_type or capabilities ?
What role is your non-admin user? Is it one of the stock WP roles or have you created a new one? If it’s a new one, which capabilities have you given it?
Its a custom role and i gaved it almost all the stuff to manage the “farm” type:
'capability_type' => 'post',
However i’ve checked the code meanwhile and as mentioned into another post
it seems that this has fixed the problem:
add_filter('revisionize_user_can_revisionize', function() {
return current_user_can('edit_farms') || current_user_can('edit_farm');
});
add_filter('revisionize_user_can_publish_revision', function() {
return current_user_can('publish_farms');
});
is this the correct things to do?
'capability_type' => 'post' is the default, so you don’t even need to explicitly define that.
I think you only need to add those filters if your user doesn’t have the *_post capabilities. Is that the case?
Yes they don’t have edit_post they only have edit_farms
Using those 2 filters should work to solve your problem. But the way you’ve written them, _only_ users with edit_farms caps will be able to revisionize. You’re not including the default value. You may want to consider something like this, but of course every situation is different.
add_filter('revisionize_user_can_revisionize', function($userCan) {
return $userCan || current_user_can('edit_farms');
});
add_filter('revisionize_user_can_publish_revision', function($userCan) {
return $userCan || current_user_can('publish_farms');
});
You can always look at the source to see where these filters are being used:
https://github.com/jamiechong/revisionize/blob/master/revisionize.php#L423-L429