Skip to content

Commit 5187be8

Browse files
Merge pull request #6956 from christianbeeznest/GH-2615
Plugin: BuyCourses - Fix undefined SYS_COURSE_PATH constant using IllustrationRepository - refs #2615
2 parents f52bbb9 + eb6c728 commit 5187be8

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

public/plugin/BuyCourses/src/buy_course_plugin.class.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -805,22 +805,17 @@ public function getCourseInfo($courseId)
805805
'course_img' => null,
806806
];
807807

808-
$courseTeachers = $course->getTeachersSubscriptions();
809-
810-
foreach ($courseTeachers as $teachers) {
811-
/* @var User $user */
808+
foreach ($course->getTeachersSubscriptions() as $teachers) {
812809
$user = $teachers->getUser();
813-
$teacher['id'] = $user->getId();
814-
$teacher['name'] = $user->getFullName();
815-
$courseInfo['teachers'][] = $teacher;
810+
$courseInfo['teachers'][] = [
811+
'id' => $user->getId(),
812+
'name' => $user->getFullName(),
813+
];
816814
}
817815

818-
$possiblePath = api_get_path(SYS_COURSE_PATH);
819-
$possiblePath .= $course->getDirectory();
820-
$possiblePath .= '/course-pic.png';
821-
822-
if (file_exists($possiblePath)) {
823-
$courseInfo['course_img'] = api_get_path(WEB_COURSE_PATH).$course->getDirectory().'/course-pic.png';
816+
$imgUrl = $this->getCourseIllustrationUrl($course);
817+
if (!empty($imgUrl)) {
818+
$courseInfo['course_img'] = $imgUrl;
824819
}
825820

826821
return $courseInfo;

0 commit comments

Comments
 (0)