AnsweredAssumed Answered

Java Script no longer working after unknown code changes

Question asked by on Sep 29, 2017
Latest reply on Apr 23, 2018 by John Boekenoogen

Did anyone have their custom Java Script break? We were hiding several buttons from faculty and suddenly they have reappered. No matter what I change my Java Script to I cannot hide the buttons from faculty.  I was tolde to replace my first line with if ($.inArray("admin", ENV.current_user_roles) == -1)  which doesn't work.


Does anyone know what in God's name they changed?






Here is the original code:


// Checks that current user role is is a teacher, Admins can see the buttons. Also allows Admins who are also Teachers
// to see the buttons. You many need to adjust the current user role name and ID to match the exceptions for your institution.
// You also may need to comment out buttons that you want to allow your teachers to see.

if($.inArray('teacher',ENV['current_user_roles']) === 2 && $.inArray('admin',ENV['current_user_roles']) === 3 )
$("a:contains('Conclude this Course')").show();
else if
($.inArray('admin',ENV['current_user_roles']) === 2 || $.inArray('admin',ENV['current_user_roles']) === 3 ) {
$("a:contains('Conclude this Course')").show();
$("a:contains('Add Section')").hide();
else {
($.inArray('teacher',ENV['current_user_roles']) === 3 )
$("a:contains('Conclude this Course')").hide();