Hide Help Menu item based on custom role or sub-account
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022
07:49 AM
I created a new sub-account for a new program we're staring. I have also created a duplicate of the student role for these students. There are a couple of menu items on the Help menu that I would like hidden from the students in just this sub-account. How would I go about hiding the menu items from these students? The duplicate role does not show up as an option when I am editing the permissions, and when I go into the sub-account, there isn't an option to edit the help menu.
Solved! Go to Solution.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2022
06:36 AM
Would this in the sub-account theme do the job? Part of the problem is that the Help menu is built on the fly using React so you have to monitor it.
function hideHelpItem(){
if ( ENV.current_user_is_student ){
console.log('adding dom monitor');
$("body").on('DOMSubtreeModified', "#help_tray", function() {
console.log('hiding help item');
$('#help_tray a:contains("Thing you want to hide")').hide();
});
}
}
$(document).ready(function () {
hideHelpItem();
});