From eb6c7282475e22229bcee30adcca946c23a0fd0a Mon Sep 17 00:00:00 2001 From: Christian Beeznest Date: Tue, 28 Oct 2025 08:33:22 -0500 Subject: [PATCH] Plugin: BuyCourses - Fix undefined SYS_COURSE_PATH constant using IllustrationRepository - refs #2615 --- .../src/buy_course_plugin.class.php | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/public/plugin/BuyCourses/src/buy_course_plugin.class.php b/public/plugin/BuyCourses/src/buy_course_plugin.class.php index 7eb3bdc9ad4..1c38abc844e 100644 --- a/public/plugin/BuyCourses/src/buy_course_plugin.class.php +++ b/public/plugin/BuyCourses/src/buy_course_plugin.class.php @@ -805,22 +805,17 @@ public function getCourseInfo($courseId) 'course_img' => null, ]; - $courseTeachers = $course->getTeachersSubscriptions(); - - foreach ($courseTeachers as $teachers) { - /* @var User $user */ + foreach ($course->getTeachersSubscriptions() as $teachers) { $user = $teachers->getUser(); - $teacher['id'] = $user->getId(); - $teacher['name'] = $user->getFullName(); - $courseInfo['teachers'][] = $teacher; + $courseInfo['teachers'][] = [ + 'id' => $user->getId(), + 'name' => $user->getFullName(), + ]; } - $possiblePath = api_get_path(SYS_COURSE_PATH); - $possiblePath .= $course->getDirectory(); - $possiblePath .= '/course-pic.png'; - - if (file_exists($possiblePath)) { - $courseInfo['course_img'] = api_get_path(WEB_COURSE_PATH).$course->getDirectory().'/course-pic.png'; + $imgUrl = $this->getCourseIllustrationUrl($course); + if (!empty($imgUrl)) { + $courseInfo['course_img'] = $imgUrl; } return $courseInfo;