Support

Home Forums Event Espresso Premium Edit Event Page – Hide sections

Edit Event Page – Hide sections

Posted: November 27, 2015 at 4:10 am

Viewing 5 reply threads


Alan Coyne

November 27, 2015 at 4:10 am

Hi,

Is it possible to hide some sections on Edit Event page based on User Role?

Thanks

ALan


Tony

  • Support Staff

November 27, 2015 at 5:29 am

Hi Alan,

Event Espresso checks the capabilities of the user rather the role (a role is just a collection of capabilities) but you should be able to hide some sections.

Which section do you want to remove?


Alan Coyne

November 27, 2015 at 5:33 am

Some sections such as Page Template, Custom Fields, Notifications I would prefer not to allow user to see.


Tony

  • Support Staff

November 27, 2015 at 8:11 am

Actually, I’ve been looking over the code are there are no capability checks for individual meta boxes.

However you can remove them using the example code provided here:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/remove_EE4_meta_boxes.php

Only remove the sections you need to remove and note that some metaboxes EE will be expecting a response from so if you remove them the event may not save so you’ll need to test each change.

You can check the capability and remove the meta-boxes if the user doesn’t have a specific cap, for example:

if ( ! current_user_can( 'manage_options' ) {
//Remove page_templates metabox if the user does not have 'manage_options'
//capability which would usually be an admin role.
remove_meta_box( 'page_templates', 'espresso_events', 'side' );
}

https://codex.wordpress.org/Function_Reference/current_user_can


Josh

  • Support Staff

November 27, 2015 at 8:12 am

Hi Alan,

There’s some example code in our code snippet library that you can use. Please note that you will not use all of the hooks there, you use only the ones that work to remove the sections you want to remove.

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/remove_EE4_meta_boxes.php


Alan Coyne

November 30, 2015 at 8:25 am

Thanks …I’ll work with these

Viewing 5 reply threads

The support post ‘Edit Event Page – Hide sections’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso