Browse Source

Fix lang var, format code, get correct student list see BT#15114

Julio Montoya 6 years ago
parent
commit
ee5d8a55a6
2 changed files with 4 additions and 9 deletions
  1. 2 7
      main/inc/lib/course.lib.php
  2. 2 2
      main/user/subscribe_user.php

+ 2 - 7
main/inc/lib/course.lib.php

@@ -590,12 +590,7 @@ class CourseManager
         $courseCode = $courseInfo['code'];
         $userCourseCategoryId = (int) $userCourseCategoryId;
 
-        if (!empty($session_id)) {
-            $session_id = intval($session_id);
-        } else {
-            $session_id = api_get_session_id();
-        }
-
+        $session_id = empty($session_id) ? api_get_session_id() : (int) $session_id;
         $status = ($status == STUDENT || $status == COURSEMANAGER) ? $status : STUDENT;
 
         // A preliminary check whether the user has been already registered on the platform.
@@ -831,7 +826,7 @@ class CourseManager
                         0,
                         null,
                         null,
-                        null,
+                        STUDENT,
                         true,
                         false
                     );

+ 2 - 2
main/user/subscribe_user.php

@@ -88,7 +88,7 @@ if (isset($_REQUEST['register'])) {
             if ($result) {
                 Display::addFlash(Display::return_message($message));
             } else {
-                Display::addFlash(Display::return_message(get_lang('ErrorContactPlatformAdmin'), 'warning'));
+                Display::addFlash(Display::return_message(get_lang('MaxNumberSubscribedStudentsReached'), 'warning'));
             }
         }
     }
@@ -134,7 +134,7 @@ if (isset($_POST['action'])) {
                             if ($result) {
                                 $isSuscribe[] = $message;
                             } else {
-                                $isSuscribe[] = get_lang('ErrorContactPlatformAdmin').' '.$userInfo['complete_name_with_username'];
+                                $isSuscribe[] = get_lang('MaxNumberSubscribedStudentsReached').' '.$userInfo['complete_name_with_username'];
                             }
                         }
                     }