By default, I am allowing people to subscribe as contributors to my site which allows them certain actions.
What I then want to do is remove Posts, Comments, Contact (ContactForm7) and Tools leaving them only options to add new Events (events plugin).
I also want to be sure that even though these buttons are hidden, people cannot submit to these PostTypes if they knew how to.
I am reading through the Professional WordPress plugins development book at the moment and it's a lot to take in so I'd like to do this just in my theme's functions page for now.
Here's what I am trying according to the codex:
add_action( 'admin_menu', 'jh_remove_menu_pages' );
function jh_remove_menu_pages() {
remove_menu_page('edit-comments.php');
remove_menu_page('tools.php');
remove_menu_page('edit.php');
remove_menu_page('wp-contact-form-7.php');
}
I've managed to do a find on this page to fins all the php files I need to hide but I am not sure about the ContactForm7 file. EDIT: Managed to find solution here to remove Contact Form 7 from Admin Menu
According to the codex though, the code above does not remove the permissions for them to access the screens (posts, tools etc) directly and still submit if they knew how: "Please be aware that this would not prevent a user from accessing these screens directly. Removing a menu does not replace the need to filter a user's permissions as appropriate."
How would I remove the capabilities of all the above except the for Events and Profile? I'm reading through remove_cap in the codex, but I am concerned that I might inadvertently switch off posting Events if I remove the Posts capability?
And lastly, how do I show only the related Events for the user who is logged in at the time?
Many thanks.