diff --git a/core/core.php b/core/core.php index bfaf479..842d4d6 100644 --- a/core/core.php +++ b/core/core.php @@ -1455,8 +1455,9 @@ class common * @param string $userId identifiant de l'utilisateur * @param string $courseId identifiant du cours sollicité */ - public function courseUserEnrolment($courseId, $userId = null) + public function courseIsUserEnroled($courseId) { + $userId = $this->getUser('id'); $group = $userId ? $this->getData(['user', $userId, 'group']) : false; switch ($group) { case self::GROUP_ADMIN: diff --git a/core/module/course/course.php b/core/module/course/course.php index 1177c05..50e1258 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -316,7 +316,7 @@ class course extends common self::$swapMessage['submitLabel'] = 'Se connecter'; self::$swapMessage['enrolmentMessage'] = ''; self::$swapMessage['enrolmentKey'] = ''; - if ($this->courseUserEnrolment($courseId, $userId) === false) { + if ($this->courseIsUserEnroled($courseId) === false) { switch ($this->getData(['course', $courseId, 'enrolment'])) { case self::COURSE_ENROLMENT_GUEST: case self::COURSE_ENROLMENT_SELF: @@ -335,7 +335,7 @@ class course extends common break; } } - + // Valeurs en sortie $this->addOutput([ 'title' => sprintf(helper::translate('Accéder au cours %s'), $this->getData(['course', $this->getUrl(2), 'shortTitle'])),