Catalog visibility in Tutor deployed Open edX

I investigated a little and reproduced your problem: it boils down to the fact that /courses is not the catalog, and the courses that are displayed there are unaffected by the visibility settings from the advanced settings. If you’d like to disable this page entirely, then you need to set FEATURES["ENABLE_COURSE_DISCOVERY"] = False in the lms settings. I suggest you create a small plugin to resolve this (and please post it here ;))

2 Likes

sorry my late response here. the first proposed solution was sufficient for us.

A follow up: Does this configuration (ENABLE_COURSE_DISCOVERY=FALSE) affect the Discovery service, or is it a separate thing with the same name?

This setting does not affect the Discovery service, this is an unfortunate naming collision.

1 Like

How shall I create this plugin?
Should I make a yml with the following and enable it ?

name: myplugin
version: 0.1.0
patches:
  common-env-features: |
          "ENABLE_COURSE_DISCOVERY": false

@regis I’m running into this issue too now of wanting to hide courses from Discover New but it not obeying what’s specified in the advanced settings “visibility”. What’s the right way syntactically to make this setting play nice with the other setting I set from another thread? I.e. I put

name: set_default_enrollment
version: 0.1.0
patches:
 lms-env: |
  "COURSE_MODE_DEFAULTS": {
    "name": "Honor",
    "slug": "honor",
    "bulk_sku": null,
    "currency": "eur",
    "description": null,
    "expiration_datetime": null,
    "min_price": 0,
    "sku": null,
    "suggested_prices": ""
  }
  common-env-features: |
   "ENABLE_COURSE_DISCOVERY": false

I also tried with an empty line before common-env-features above. And the below:

name: set_default_enrollment
version: 0.1.0
patches:
 lms-env: |
  "COURSE_MODE_DEFAULTS": {
    "name": "Honor",
    "slug": "honor",
    "bulk_sku": null,
    "currency": "eur",
    "description": null,
    "expiration_datetime": null,
    "min_price": 0,
    "sku": null,
    "suggested_prices": ""
  }
  lms-env: |
   "ENABLE_COURSE_DISCOVERY": false

but I get an error during tutor local quickstart for both. Are those names like “lms-env” and “common-env-features” specific namespaces that I need to look up (if so, where are they listed)? Or are they just arbitrary names the plugin author is selecting to keep things straight for themselves?

@oedx You should learn more about plugins and patches. See this: Plugin API — Tutor documentation
And in particular: Plugin API — Tutor documentation

In a nutshell: patches are blobs of text that are inserted in templates whenever you run tutor config save (or quickstart). To find the list of supported patches, you need to look at the Tutor source code (see the note in the docs above). The “lms-env” patch is included in a json file: tutor/lms.env.json at 6ca863e04c5943002f94a8bbc877494444242bf9 · overhangio/tutor · GitHub
Thus, the “lms-env” patch should be formatted as json. Also, you should not define it twice, otherwise one will override the other.
Please open a new topic if you need further clarifications on the topic of plugins.

The reason I was still posting in this topic is because the subject line is my topic, but it was never fully solved here. Because you suggested he create and post a patching plugin, but never confirmed if his example was right or not.

So for instance now I’ve tried:

name: set_default_enrollment
version: 0.1.0
patches:
 lms-env: |
  "COURSE_MODE_DEFAULTS": {
    "name": "Honor",
    "slug": "honor",
    "bulk_sku": null,
    "currency": "usd",
    "description": null,
    "expiration_datetime": null,
    "min_price": 0,
    "sku": null,
    "suggested_prices": ""
  }
patches:
 lms-env-features: |
  "ENABLE_COURSE_DISCOVERY": false,
  "ENABLE_COURSEWARE_SEARCH": false,
  "ENABLE_DASHBOARD_SEARCH": false

But the net result when I grep for it is:

/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json:    "ENABLE_COURSE_DISCOVERY": false,
/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json:    "ENABLE_COURSE_DISCOVERY": true,

So it seems like what he posted above wouldn’t necessarily work, since it seems to just inject the stuff at line 10 of tutor/lms.env.json at 6ca863e04c5943002f94a8bbc877494444242bf9 · overhangio/tutor · GitHub
But, then there will be duplicative values below it. (And my course discovery UI is still not hidden so I assume it’s using the true below the false.)

Also I got the same results (two hits in grep) when I tried a variant from some other thread (How to set ENABLE_COURSEWARE_SEARCH flag in configuration):

patches:
 openedx-common-settings: |
  FEATURES["ENABLE_COURSE_DISCOVERY"] = False,
  FEATURES["ENABLE_COURSEWARE_SEARCH"] = False,
  FEATURES["ENABLE_DASHBOARD_SEARCH"] = False

So what’s the correct way to override an existing variable instead of patching in variables which were not present in the first place? I would think it’s the “config” “set” mechanism, but there’s no example for how to use this in YAML and I can’t write a python plugin

This is the right way to do it. Even better: because these settings are only necessary in the LMS, and not the CMS, you should use the “openedx-lms-common-settings” patch instead of “openedx-common-settings”. (but the latter will work nonetheless)

Values from lms.env.json are picked up by edx-platform/lms/envs/common.py. These values are then overloaded by tutor/production.py. The “openedx-lms-common-settings” patch (and “openedx-common-settings” as well) add content to tutor/production.py. So the latter solution should be working.

To isolate variables, I split this into two plugins and shown below. But you can see that the net result from that is not even duplicate values, but instead just no changes:

tutor@ip-123-123-123-123:/home/ubuntu$ tutor plugins list
discovery==11.0.0
ecommerce==11.0.0 (disabled)
license==11.0.0 (disabled)
minio==11.0.0 (disabled)
notes==11.0.0
xqueue==11.0.0 (disabled)
disable_course_discovery==0.1.0
set_default_enrollment==0.1.0
tutor@ip-123-123-123-123:/home/ubuntu$ nano ~/.local/share/tutor-plugins/disable_course_discovery.yml
tutor@ip-123-123-123-123:/home/ubuntu$ cat ~/.local/share/tutor-plugins/disable_course_discovery.yml
name: disable_course_discovery
version: 0.1.0
patches:
openedx-lms-common-settings: |
FEATURES[“ENABLE_COURSE_DISCOVERY”] = False,
FEATURES[“ENABLE_COURSEWARE_SEARCH”] = False,
FEATURES[“ENABLE_DASHBOARD_SEARCH”] = False
tutor@ip-123-123-123-123:/home/ubuntu$ cat ~/.local/share/tutor-plugins/set_default_enrollement.yml
name: set_default_enrollment
version: 0.1.0
patches:
lms-env: |
“COURSE_MODE_DEFAULTS”: {
“name”: “Honor”,
“slug”: “honor”,
“bulk_sku”: null,
“currency”: “usd”,
“description”: null,
“expiration_datetime”: null,
“min_price”: 0,
“sku”: null,
“suggested_prices”: “”
}

tutor@ip-123-123-123-123:/home/ubuntu$ tutor config save
Configuration saved to /home/tutor/.local/share/tutor/config.yml
Environment generated in /home/tutor/.local/share/tutor/env
tutor@ip-123-123-123-123:/home/ubuntu$ tutor local quickstart

tutor@ip-123-123-123-123:/home/ubuntu$ grep -r ENABLE_COURSE_DISCOVERY “$(tutor config printroot)/env/apps/openedx/config/”
/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json: “ENABLE_COURSE_DISCOVERY”: true,
tutor@ip-123-123-123-123:/home/ubuntu$ grep -r ENABLE_DASHBOARD_SEARCH “$(tutor config printroot)/env/apps/openedx/config/”
/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json: “ENABLE_DASHBOARD_SEARCH”: true,

So this isn’t even leading to duplicates, it’s just leading to no changes at all.

Should I be seeing changes reflected in the config.yml immediately after “tutor config save”? Because I don’t, and perhaps that means it’s some syntactic parsing issue that’s stopping the plugin from being consumed?

tutor@ip-123-123-123-123:/home/ubuntu$ nano $(tutor plugins printroot)/disable_course_discovery.yml
tutor@ip-123-123-123-123:/home/ubuntu$ tutor config save
Configuration saved to /home/tutor/.local/share/tutor/config.yml
Environment generated in /home/tutor/.local/share/tutor/env
tutor@ip-123-123-123-123:/home/ubuntu$ grep -r ENABLE_COURSE_DISCOVERY /home/tutor/.local/share/tutor/config.yml
tutor@ip-123-123-123-123:/home/ubuntu$

@regis I just wanted to bump this since my site is close to going live but I still haven’t been able to hide courses from the “explore courses” or search. Basically I did exactly what you specified, via a separate plugin, but it didn’t work.

I understand the situation you are in @oedx. However, the problem you are facing is not a bug, it’s a customisation issue, and thus not really my job to address. To help you more, I would have to do the work of creating the plugin and testing it myself. Unfortunately, I do not have the time to do this for free. This is usually the kind of work that people hire me for.

For the thread record, the ultimate solution to my issue which regis helped find was that the discovery plugin had to be disabled because this plugins adds “FEATURES[“ENABLE_COURSE_DISCOVERY”] = True” to the platform settings.

So if we want to utilize Course Searching but hide courses from it, there is no solution to this, if I am following this correctly.

Thanks!

Even though I have the “discovery” plugin disabled, I still have duplicate values of ENABLE_COURSE_DISCOVERY.
Looking at this template file in the source code:

Since the value for ENABLE_COURSE_DISCOVERY has been hard-coded there to “true”, there is no ways to overwrite it to false using a patching plugin!

There is. You need to override the value in the Python settings, as described above.

Hi

I’ve been look at this for myself for the last couple of days and it looks like what is happening is that when the tutor config save command is run that it merges the changes with a default dictionary which includes the

lines

“ENABLE_COURSE_DISCOVERY”: true,
“ENABLE_COURSEWARE_SEARCH”: true,
“ENABLE_CSMH_EXTENDED”: false,
“ENABLE_DASHBOARD_SEARCH”: true,

With these being outside the region that would contain the patch for lms-env features

even changing the lms.env.json file directly is overwritten when the tutor env is generated.

at this point while I don’t doubt the logic @regis I am not seeing the behaviour that I would expect from that logic.

Any ideas?? Short of creating a pr and changing those lines to be something line

“ENABLE_COURSE_DISCOVERY”: "{{ COURSE_DISCOVERY }}

and setting a new true or false value for course discovery in the config.yml file

1 Like

Thank you for the suggestion. It works fine while you don’t enable discovery plugin. This plugin will overwrite ENABLE_COURSE_DISCOVERY to True

UPDATE: It turned out that in terms of Open Edx Course Catalog is the index page of the platform available only for not logged in users. Thereby Course Visibility In Catalog advanced setting affecting only this page. Page /courses is the list of all courses user could enrol. To hide the course from this list course admin must set enrolment start and enrolment end dates to the dates in the past.

In case you don’t want to create plugins or have no idea how to create plugin.
Just follow these steps:

  • nano "$(tutor config printroot)/env/apps/openedx/config/lms.env.json"
  • Update value of ENABLE_COURSE_DISCOVERY: false (Originally it’s true)
  • tutor local restart (To take effect)

Thank me later…

This is NOT a good idea. Read this for more information: Concepts — Tutor documentation

And in particular:

Because the Tutor environment is generated entirely from the values in config.yml, you can rm -rf the env/ folder at any time and re-create it with tutor config save. Another consequence is that any manual change made to a file in env/ will be overwritten by tutor config save commands. Consider yourself warned!