From fc1a4a9e74417a918305143ce90ee4fca0f2841e Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 5 Jan 2015 15:09:56 -0500 Subject: [PATCH] Allow to the invited users enter in their assigned courses only - refs BT#9070 --- main/course_home/course_home.php | 10 ++++++++++ main/inc/lib/course.lib.php | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/main/course_home/course_home.php b/main/course_home/course_home.php index d9680d1a2f..e50b2d78f3 100755 --- a/main/course_home/course_home.php +++ b/main/course_home/course_home.php @@ -142,8 +142,18 @@ define('TOOL_ADMIN_VISIBLE', 'tooladminvisible'); $user_id = api_get_user_id(); $course_code = api_get_course_id(); +$sessionId = api_get_session_id(); $show_message = ''; +if (api_is_invited_user()) { + $isInASession = $sessionId > 0; + $isSubscribed = CourseManager::is_user_subscribed_in_course($user_id, $course_code, $isInASession, $sessionId); + + if (!$isSubscribed) { + api_not_allowed(true); + } +} + //Deleting group session Session::erase('toolgroup'); Session::erase('_gid'); diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index a57e70b365..41d07230c5 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -4535,6 +4535,11 @@ class CourseManager public static function return_hot_courses($days = 30, $limit = 5) { global $_configuration; + + if (api_is_invited_user()) { + return array(); + } + $limit = intval($limit); // Getting my courses