Browse Source

Fix condition whereby a user that never accessed a session with duration to which he is subscribed could not see it in courses list - refs #8317

Yannick Warnier 10 years ago
parent
commit
325c14fcb7
1 changed files with 5 additions and 0 deletions
  1. 5 0
      main/inc/lib/main_api.lib.php

+ 5 - 0
main/inc/lib/main_api.lib.php

@@ -2024,6 +2024,11 @@ function api_get_session_visibility($session_id, $course_code = null, $ignore_vi
                             $session_id,
                             api_get_user_id()
                         );
+                        // If there is a session duration but there is no previous
+                        // access by the user, then the session is still available
+                        if (count($courseAccess) == 0) {
+                            return SESSION_AVAILABLE;
+                        }
                         $currentTime = time();
                         $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
                         $userDurationData = SessionManager::getUserSession(