The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
We want to remove the ability for instructors to edit and change the course image. Does anyone have any code (CSS or JavaScript) that would do this?
Thank you in advance for any assistance you can provide.
Solved! Go to Solution.
Hi @casey_eubank,
Try this:
if ((/^\/courses\/[0-9]+\/settings$/.test(window.location.pathname)) && (!ENV.current_user_roles.includes('root_admin'))) {
let courseImageChangeButtons=document.querySelectorAll('.CourseImageSelector__Button, .CourseImageSelector > button');
for (let i = 0; i < courseImageChangeButtons.length; i++)
courseImageChangeButtons[i].style.display='none';
}
-Chris
Hi @casey_eubank,
The following js code should hide the selection buttons. You'll want to wrap this with an if statement to only apply it to faculty (or maybe non-admins) if that's your wish. If you want this completely hidden for everyone, css would be easier, but doing by for only specific roles needs to be done with js as far as I know.
let courseImageChangeButtons=document.querySelectorAll('.CourseImageSelector__Button, .CourseImageSelector > button');
for (let i = 0; i < courseImageChangeButtons.length; i++)
courseImageChangeButtons[i].style.display='none';
Hope this helps a bit!
-Chris
Thank you so much @chriscas! We would like to restrict to anyone who is not a root admin, so sub-account admins, faculty, etc.
Would you be able to help with amending the code to include that?
I promise I will take some classes soon so I can learn to do this myself! 🙂
Hi @casey_eubank,
Try this:
if ((/^\/courses\/[0-9]+\/settings$/.test(window.location.pathname)) && (!ENV.current_user_roles.includes('root_admin'))) {
let courseImageChangeButtons=document.querySelectorAll('.CourseImageSelector__Button, .CourseImageSelector > button');
for (let i = 0; i < courseImageChangeButtons.length; i++)
courseImageChangeButtons[i].style.display='none';
}
-Chris
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in