Support

Home Forums Event Espresso Premium Adminimize not working with event and venue write options

Adminimize not working with event and venue write options

Posted: March 25, 2019 at 5:34 pm

Viewing 7 reply threads


mcotten

March 25, 2019 at 5:34 pm

I’d like to remove some the write options for the Events Administrator role such as custom fields. I’ve installed Adminimize and it lists write options for Events and Venues but my deactivate selections have no effect. I can successfully hide Event Espresso menu options and I’ve confirmed I can deactivate write options for posts and pages but no luck with events and venues.

I’m using Event Espresso 4.9.79 with WordPress 5.1.1. Can anyone replicate my problem?


Josh

  • Support Staff

March 26, 2019 at 9:26 am

Hi,

The Adminimize plugin appears to only hook in to native custom post type routes, and Event Espresso doesn’t use native custom post type routes for its editors. Event Espresso uses custom custom post type editor routes only.

What you can do instead is hook into editor and use the remove_meta_box() function to remove any unneeded metaboxes. For example:

add_action(
    'admin_enqueue_scripts',
    'my_remove_boxes_from_events',
    30
);
function my_remove_boxes_from_events() {
    // custom fields
    remove_meta_box(
        'postcustom', 'espresso_events', 'normal'
    );
    // add more here
}

will remove the custom fields metabox from the Event Espresso event editor. The code can be added to a theme’s functions.php file.


mcotten

March 26, 2019 at 11:10 am

This worked great, thank you!

The only option that I was not able to remove this way was “Notifications” in Events. I’d also like to remove the “Available Tickets” if possible as we are not utilizing the ticket registration feature.


Josh

  • Support Staff

March 26, 2019 at 11:30 am

This will remove “Notfications”:

remove_meta_box(
'espresso_events_Messages_Hooks_Extend_messages_metabox_metabox',
'espresso_events',
'advanced'
);

The Tickets section cannot simply be removed, one reason is because it shares the same box with Datetimes. There may be a way to restrict access to edit fields within tickets based on the current user’s capability though. I can check into that.


mcotten

March 26, 2019 at 11:33 am

Thank you. Your help is much appreciated!


mcotten

March 26, 2019 at 12:28 pm

As an admin, I’m seeing the options hidden that I’ve listed in functions.php but the results are not consistent when logging into a custom role I created. Any idea why?


mcotten

March 26, 2019 at 1:48 pm

Using an admin specific css file works for what I’m trying to accomplish:
https://clicknathan.com/web-design/hide-wordpress-admin-elements/
Thanks again for your assistance.


Josh

  • Support Staff

March 27, 2019 at 7:43 am

No idea why your custom role would see the items you’ve removed with remove_meta_box(). Just a guess: Your functions.php file isn’t firing in time on the admin_enqueue_scripts hook when the user is logged in with a custom role.

Adding the code to a plugin would ensure the code is loaded at an early enough moment.

Viewing 7 reply threads

The support post ‘Adminimize not working with event and venue write options’ 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