Found this content helpful? Log in or sign up to leave a like!

Hide tabs in the course settings (navigation and Integration tabs)

Jump to solution
martin_kabat
Community Participant

Hi all,

We would like to hide the "Navigation" and "Integration" tabs on the course setting page, from teachers. 

Anyone any ideas, please?

Thank you

0 Likes
1 Solution
robotcars
Community Champion

Hi,

@PamelaPatterson, has pointed out that UI changes have required this to be updated. Here is a modified version that should handle the use cases requested in this thread.

 

/* css removes these options for all users, even admin */
#course_settings_tabs_mount [id^="tab-navigation"],
#course_settings_tabs_mount [id^="tab-integrations"] {
    display: none;
}

 

// remove these tabs for non-admin users
// also removes the mounted panel ui if the user navigates from history/bookmark
(function () {
  'use strict';

  if (/\/courses\/\d+\/(details|settings)/.test(window.location.pathname)) {
    if (!['root_admin','admin'].some(a => ENV.current_user_roles.includes(a))) {
      [...document.querySelectorAll('[id^="tab-navigation"]')].forEach(e => e.remove());
      [...document.querySelectorAll('[id^="tab-integrations"]')].forEach(e => e.remove());
    }
  }
})();

 

View solution in original post