-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.4.2
Moodle's current behavior when a course is created through the API via the core_course_create_courses function ignores the site default setting for course visibility.
The API call must include the visibile flag = 0, or else the course will be visible on creation. I find this to be counter-intuitive.
To test, make sure the default setting at admin/settings.php?section=coursesettings for course visibility is hidden.
Next, I manually created a course with the GUI and confirmed it was hidden
Then I ran two calls, one with one with no visible flag and one with the visible flag set to hidden.
[https://sandbox.moodledemo.net/webservice/rest/server.php?wsfunction=core_course_create_courses&wstoken=dfa63e90ab9a229fea70dd8c3f722315&courses[0][fullname]=API] Course No Flag&courses[0][shortname]=API1&courses[0][categoryid]=1
[https://sandbox.moodledemo.net/webservice/rest/server.php?wsfunction=core_course_create_courses&wstoken=dfa63e90ab9a229fea70dd8c3f722315&courses[0][fullname]=API] Course Visible Flag Set&courses[0][shortname]=API2&courses[0][categoryid]=1&courses[0][visible]=0
resulting in two courses - the one with no flag is visible.
I think courses created via web services should behave the same as courses created on the front end if no options are specified in the call.