Remove Category & course browsing for students

Re: Remove Category & course browsing for students

by Jon Bolton -
Number of replies: 10
Picture of Particularly helpful Moodlers Picture of Testers

if you're using the Boost theme, go to Site Administration > Appearance > Themes > Boost and then click on Advanced Settings and enter the following into the "Raw SCSS" box...

#page-course-index-category form#coursesearch {display: none;}
#page-course-index-category .categorypicker {display: none;}
In reply to Jon Bolton

Re: Remove Category & course browsing for students

by E Martin -
Thank you Jon, I had the same need as Karishma - in your experience have you seen CSS modifications such as these fail when a theme is updated? If so, is it often? (I assume themes get updated with major Moodle versions....?)
In reply to E Martin

Re: Remove Category & course browsing for students

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
It depends where you add the css. If you have a custom css section in your theme settings, any additions will (should!) be honoured in an upgrade.

The other thing to think about is the possibility of css failing if a selector that you’re targeting changes after an upgrade. Unusual, but nit unheard of. Obviously, you’d be taking a backup before any upgrade though 😉
In reply to Jon Bolton

Re: Remove Category & course browsing for students

by E Martin -
I know this is a super late response, Jon, but I'm revisiting this issue. Do you know who understands the boost theme well? I notice you target #page-course-index-category in addition to .categorypicker

Does this make it specific to this page, while .categorypicker is general throughout the theme in other contexts?

The institution I'm at doesn't have a test server so I'm sweating bullets about attempting the display:none without knowing it's specific to just that type of page. Ex: for form#coursesearch, what if this also applied to other contexts, for example where a site manager is searching for courses in the context of importing?

I guess what I'm asking is, is there a way of ensuring the CSS injection is effectively page specific?

Here's the page I'm fretting over: https://moodle.sd57.bc.ca/course/index.php?categoryid=3 (it's a category view)
In reply to E Martin

Re: Remove Category & course browsing for students

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Yes, the form#coursesearch is also applied to other contexts - definitely in the Site Admin > Courses > Manage courses and categories pages.

The inclusion of #page-course-index-category forces the rules to ONLY apply to #coursesearch on those pages - but it will affect the course search on ALL browse category pages.

Note the categoryid=3 at the end of the URL you supplied. This CSS will target only that category:

#page-course-index-category .category-3 form#coursesearch {display: none;}
#page-course-index-category .category-3 .categorypicker {display: none;}
Average of ratings: Useful (1)
In reply to Jon Bolton

Re: Remove Category & course browsing for students

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
ps - the above WILL work, but if you want to "test" things beforehand, remember that custom css is as easy to remove as it is to add, so you're not making a permanent change.

You could also just highlight what is being targeted by the css before changing the display: none using this...

#page-course-index-category .category-3 form#coursesearch {background: yellow;}
#page-course-index-category .category-3 .categorypicker {background: yellow;}
and when you're happy, change the background: yellow; to display: none;
Average of ratings: Useful (1)
In reply to Jon Bolton

Re: Remove Category & course browsing for students

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
pps - you've said you only went to target the CIDES category (categoryid=3) - but that page also has sub-categories... so you might want to also target categories 57, 66, 54, 59, 55, 58, 52, 56 - just a thought 🙂
Average of ratings: Useful (1)
In reply to Jon Bolton

Re: Remove Category & course browsing for students

by E Martin -
Jon, I'm not sure what to say other than thank you: you're giving me the tools I need to improve our school district's interface and you're doing it free, from another hemisphere. If we were coworkers I'd be thinking about how I could take you out for a lunch right now.

Brilliant low-risk recommendation regarding the background.
In reply to E Martin

Re: Remove Category & course browsing for students

by E Martin -
Weird. The following works:
#page-course-index-category .categorypicker {display: none;}

But making it category specific does not:
#page-course-index-category .category-3 .categorypicker {display: none;}


Update: following the guidance of https://stackoverflow.com/questions/5196583/target-elements-with-multiple-classes-within-one-rule/5196611 if I want dual-conditions to be true (element must have ID page-course-index-category AND class categorypicker) the following CSS appears to work. Amazing how a difference of one space character works. smile

#page-course-index-category.category-3 .categorypicker {display: none;}

Update 2: when I launch a subcategory, the boost theme seems to attach a hierarchy into the CSS class structure. Notice that when category 3 contains category 54, the following CSS exists in category 54... this means if I target the parent, the children are automatically affected.

id="page-course-index-category" class="format-site path-course path-course-index chrome dir-ltr lang-en yui-skin-sam yui3-skin-sam moodle-sd57-bc-ca pagelayout-coursecategory course-1 context-73199 category-54 category-3 drawer-open-left jsenabled"
In reply to E Martin

Re: Remove Category & course browsing for students

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

Oops, the space IS important - sorry, missed that in my haste to answer.

Great that it’s targeting the sub cats too! 👍

I’ll accept a useful rating instead of lunch... 😉

Average of ratings: Useful (1)
In reply to Jon Bolton

Re: Remove Category & course browsing for students

by E Martin -
I've never done this before - if I do it once in a thread is that sufficient? Or do I do this on an individual response by response level? lol now I'm asking a forum remember to show me how to rate them as useful. Anyways absolutely - I tried my best, let me know if that is what you meant.