Below is the code that I wrote to hide a number of things from faculty such as: the start and end date so they don't go changing the dates after we set them, breaking tools like Dropout Detective; hiding the conclude button, so they don't conclude courses where students still have incompletes to finish; hiding the public course setting after many instructors have made their course public in the intent to publish it for their students.
I know the code that Shane posted was only one line (inside of the if statement), but I've found that it is a good practice to have your javascript check which page the user is viewing before running. This way anything inside won't need to run at all when the user isn't on the page where the changes are needed and the code will run a little faster. Shane's code is not only running on every page, but it is also running for students, every time they look at any page. I run the role setup code at the start of my js file so that I have access to the role variable wherever I need it.
/* role setup */
var leng = ENV['current_user_roles'].length - 1
var role = ENV['current_user_roles'][leng];
if ((window.location.href.indexOf("details") > 0 || window.location.href.indexOf("settings") > 0) && role == "teacher") {
$("a.btn.button-sidebar-wide.delete_course_link").hide();
$("#course_start_at").parent().hide();
$("#course_conclude_at").parent().hide();
$("#course_visibility").hide();
$("a:contains('Conclude this Course')").hide();
}
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.