From ba6cfd72877080a7e0a0f90bceb3e6bb7ea91cb6 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 26 May 2020 08:27:44 +0200 Subject: [PATCH] BBB: Fix fatal error when course doesn't exists + fix anon users BT#17287 --- plugin/bbb/lib/bbb.lib.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 1f6d8ec1ae..0b33d00247 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -102,11 +102,15 @@ class bbb // If we are following a link to a global "per user" conference // then generate a random guest name to join the conference // because there is no part of the process where we give a name - $this->userCompleteName = 'Guest'.rand(1000, 9999); + //$this->userCompleteName = 'Guest'.rand(1000, 9999); } else { $this->userCompleteName = $userInfo['complete_name']; } + if (api_is_anonymous()) { + $this->userCompleteName = 'Guest'.rand(1000, 9999); + } + $this->salt = $bbb_salt; if (!empty($bbb_host)) { if (substr($bbb_host, -1, 1) !== '/') { @@ -173,9 +177,17 @@ class bbb return ''; } + $courseCode = $this->courseCode; + if (!empty($courseId)) { + $course = api_get_course_info_by_id($courseId); + if ($course) { + $courseCode = $course['code']; + } + } + return http_build_query( [ - 'cidReq' => $courseId ? api_get_course_entity($courseId)->getCode() : $this->courseCode, + 'cidReq' => $courseCode, 'id_session' => $sessionId ?: $this->sessionId, 'gidReq' => $groupId ?: $this->groupId, ]