How to hide courses from "Discover New"?

I’m running Koa, and I have 10 courses. 8/10 are more like labs, so they’re not supposed to be listed for students. I have their advanced properties visibility set to “about”, so that we can link to their page and let students register to see their material when needed. So then they properly don’t show up in the main site. However, when someone clicks on “Discover New”, then all the courses, including our various sandbox testing courses show up for the students.

How can I hide courses from the Discover New view?

(Also how can I hide from search, since it looks like things show up in search too.)

@oedx Unfortunately, this setting is much trickier than it should be. I’m glad you asked! Hopefully having this posted will help others too.

To get the LMS to use the Advanced Settings Course Visibility setting in Studio, you have to change another setting on the LMS service.

Site configuration

  1. Login to your LMS as a staff + superuser, and go to the Django Admin (https://your-lms-url/admin).

  2. Find the “Site configurations” link, and click that.

  3. Add a new Site Configuration, or edit the existing entry if you already have one.

  4. Click “Enabled” to ensure the site configuration will be used.

  5. Add these values to the “Site values” field.
    This field is in JSON format, which is fussy about quotes and commas, so you can use a JSON validator if you’re having trouble getting it to save.

    {
       "COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog",
       "COURSE_ABOUT_VISIBILITY_PERMISSION": "see_about_page"
    }
    
  6. Wait 3 minutes for the site configuration cache to clear and these settings to take effect.

(Backstory: the default settings for these permissions for legacy reasons is "see_exists", which means, "if the course exists, then show the course in the Discover Courses list and show its About page. Not a very useful default!)

New courses

There’s another useful setting, DEFAULT_COURSE_VISIBILITY_IN_CATALOG, which affects the default value Course Visibility when new courses are created. Like the Advanced Settings Course Visibility setting, this one accepts 3 different values: "both", "about", or "none".

So if you always want your new courses to have About pages, but you don’t want them to appear in the Discover Courses list until you enable them, you can include this setting inside the Site Configuration brackets ({}) too:

"DEFAULT_COURSE_VISIBILITY_IN_CATALOG": "about"

Ansible or /edx/etc

Alternatively, you can change these settings from ansible or in the lms.yml, but you’ll need to restart your LMS service in order for them to take effect.

Ansible variables:

EDXAPP_COURSE_CATALOG_VISIBILITY_PERMISSION: 'see_in_catalog'
EDXAPP_COURSE_ABOUT_VISIBILITY_PERMISSION: 'see_about_page'
EDXAPP_DEFAULT_COURSE_VISIBILITY_IN_CATALOG: 'about'

Or directly in the /edx/etc/lms.yml and /etc/etc/studio.yml files:

COURSE_CATALOG_VISIBILITY_PERMISSION: 'see_in_catalog'
COURSE_ABOUT_VISIBILITY_PERMISSION: 'see_about_page'
DEFAULT_COURSE_VISIBILITY_IN_CATALOG: 'about'
3 Likes

I think this line might be a copy and paste typo and shouldn’t have “EDXAPP_” right?

In general this sounded promising, but it didn’t seem to effect anything for me. (Also I’m using Tutor, and this thread implies they already set these variables by default (and I’m not sure whether it’s from me setting it in Django or Tutor setting it by default, but I get grep hits saying these are already set in my environment:

grep -ir COURSE_CATALOG_VISIBILITY_PERMISSION “$(tutor config printroot)/env/apps/openedx/”
/home/tutor/.local/share/tutor/env/apps/openedx/settings/lms/development.py:COURSE_CATALOG_VISIBILITY_PERMISSION = “see_in_catalog”
/home/tutor/.local/share/tutor/env/apps/openedx/settings/lms/production.py:COURSE_CATALOG_VISIBILITY_PERMISSION = “see_in_catalog”
)

I’m trying to see if I understand the two main variables there.
Does

"COURSE_ABOUT_VISIBILITY_PERMISSION": "see_about_page"

mean “It will show up in the Discover New, if the student can see the About page”? Because I want students to be able to see the about page, if and only if an instructor links to it from one of the 2/10 classes, but not see it in the Discover New, so that seems like it might not be what I’m looking for. Is there some other value that can hide something with a visible About from the Discover New?

And does

"COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog",

mean “It will show up in the Discover New, if the student can see it in the catalog” (i.e. the visibility is set to “both”)?

Because either way, I set a course to visibility of “none”, but it still showed up in Discover New, and I’m not sure why. Thanks for all your help.

Oops yes, thank you! Fixed in original post.

Good to know you’re using Tutor. And yep, looks like they are set by default in Tutor. So I’m not sure why this isn’t already working for you as expected :frowning:

But I’ll try to answer your other questions, and maybe that will help work it out?

No. It means that the platform checks the see_about_page permission when deciding whether or not to show a course’s About page. That permission runs the can_see_about_page method, which allows access if Course Visibility Advanced Setting is either the both or about, or if the current user has staff access to the course.

Almost. Similarly, the see_in_catalog permission runs the can_see_in_catalog method, which allows access if Course Visibility Advanced Setting is both, or if the current user has staff access to the course.

Have you tried checking your Discover New courses list while logged in as a student, or while logged out?

Even completely logged out a day later I can still see all the courses under http://site/courses :-/

@oedx Thank you for asking your question here too: Catalog visibility in Tutor deployed Open edX - #10 by oedx - Open edX - Overhang.IO

Hopefully you can sort it out, sorry I couldn’t help more :frowning:

For the record we eventually got this solved over in Catalog visibility in Tutor deployed Open edX - #15 by oedx - Open edX - Overhang.IO. There was a tutor plugin which was enabled which was setting ENABLE_COURSE_DISCOVERY to true.

This was a quick fix for me. I just changed in edx-search,

add below to function “course_discovery_search” in file “search/api.py”

if getattr(settings, "SEARCH_EXCLUDE_HIDDEN_COURSES", True):
   use_field_dictionary["catalog_visibility"] = 'both'