Is it possible to customize Wordpress via action, hook or anything, that
- only users of role "administrator" or "editor" may trash, spam or edit comments from the backend?
- only users of role "administrator" or "editor" may trash, spam or edit comments from mail that will be generated on new comments?
I did not find anything on codex.wordpress.org as well as I did not find a proper plugin. :-/
Thanks!
I would advice using a plugin such as User Role Editor for this, but hey - heres a working code example :):
In the the class
WP_Role
you'll find a property named ‘edit_comment’ which is mapped to the ‘edit_posts’ thus isn't handled as a separate capability. we can however modify the behaviour by applying a filter to the selected user role we want to restrict editing comments on by using the map_meta_cap function.Example for: Only users "administrator" or "editor" may trash, spam or edit comments from the backend:
Code goes into your functions.php file