Hiding a panel from certain users
-
Hi folks,
I hope you’re all well and ready for your respective festivities and the new year π
I doubt this will get any attention in the short term given the time of year but there’s no rush.
I have certain admin users who I’d like to hide certain options panels from. For talking sake let’s call these users normal admins and the options panel is the super admin only panel.
So far I’ve been able to determine that disabling sets and/or fields results in data being lost (everything in the super admin only panel) when an admin who a boolean test has determined is a normal admin goes into the options and clicks ‘save’. Obviously not ideal, so I’m trying another route whereby I hide that particular panel using some simple jQuery (loaded via the admin_footer hook) to remove its li.redux-group-tab-link-li as well as the submenu item on the left (via the custom_menu_order hook). The jQuery simply targets the span with the set name then goes up two parents (to the li) before removing it from the DOM.
Going the jQuery route is maintaining the data in the super admin only panel, but it’s got a quirk where if I navigate from one set to another and back the options have all disappeared and the page needs to be refreshed to bring them back.
I’m not looking to have you debug the tiny bit of code I’ve written, but I’m wondering if you might have an alternative suggestion which might alleviate the disappearing options quirk. Any ideas?
All the best to you and yours π
Cheers,
RS
The topic ‘Hiding a panel from certain users’ is closed to new replies.