diff --git a/course/publish/index.php b/course/publish/index.php index 2ea43c3ade2..9af10e5dfb3 100644 --- a/course/publish/index.php +++ b/course/publish/index.php @@ -62,7 +62,7 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE, //update status for all these course foreach ($sitecourses as $sitecourse) { //get the publication from the hub course id - $publication = $publicationmanager->get_publication($sitecourse['id']); + $publication = $publicationmanager->get_publication($sitecourse['id'], $hub->huburl); if (!empty($publication)) { $publication->status = $sitecourse['privacy']; $publication->timechecked = time(); diff --git a/course/publish/lib.php b/course/publish/lib.php index 09e22865680..7b805ca786e 100644 --- a/course/publish/lib.php +++ b/course/publish/lib.php @@ -177,16 +177,17 @@ class course_publish_manager { } /** - * Get a publication for a course id on the hub + * Get a publication for a course id on a hub * (which is either the id of the unique possible enrollable publication of a course, * either an id of one of the downloadable publication) * @param int $hubcourseid + * @param string $huburl * @return object publication */ - public function get_publication($hubcourseid) { + public function get_publication($hubcourseid, $huburl) { global $DB; return $DB->get_record('course_published', - array('hubcourseid' => $hubcourseid)); + array('hubcourseid' => $hubcourseid, 'huburl' => $huburl)); } /** diff --git a/course/publish/metadata.php b/course/publish/metadata.php index 12d8fdfa955..f2385f52ff4 100644 --- a/course/publish/metadata.php +++ b/course/publish/metadata.php @@ -172,7 +172,7 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE, } //save the record into the published course table - $publication = $publicationmanager->get_publication($courseids[0]); + $publication = $publicationmanager->get_publication($courseids[0], $huburl); if (empty($publication)) { //if never been published or if we share, we need to save this new publication record $publicationmanager->add_course_publication($registeredhub->huburl, $course->id, !$share, $courseids[0]);