diff --git a/main/dropbox/dropbox_functions.inc.php b/main/dropbox/dropbox_functions.inc.php index 1ecd94b9e1..c1c486a42b 100755 --- a/main/dropbox/dropbox_functions.inc.php +++ b/main/dropbox/dropbox_functions.inc.php @@ -647,7 +647,7 @@ function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategor } $userId = $current_user['user_id']; $userInfo = api_get_user_info($userId); - if ($userInfo['status'] != 20) { + if ($userInfo['status'] != INVITEE) { $groupNameListToString = ''; if (!empty($groups)) { $groupNameList = array_column($groups, 'name'); diff --git a/main/group/member_settings.php b/main/group/member_settings.php index e8b373ccd6..c4ce3bf299 100755 --- a/main/group/member_settings.php +++ b/main/group/member_settings.php @@ -136,8 +136,8 @@ $userGroup = new UserGroup(); if (!empty($complete_user_list)) { usort($complete_user_list, 'sort_users'); foreach ($complete_user_list as $index => $user) { - //prevent invitee users add to groups - see #8091 - if ($user['status'] != 20) { + //prevent invitee users add to groups or tutors - see #8091 + if ($user['status'] != INVITEE) { $officialCode = !empty($user['official_code']) ? ' - '.$user['official_code'] : null; $groups = $userGroup->getUserGroupListByUser($user['user_id']); diff --git a/main/group/tutor_settings.php b/main/group/tutor_settings.php index a1696b176f..ea2e934d18 100755 --- a/main/group/tutor_settings.php +++ b/main/group/tutor_settings.php @@ -128,27 +128,31 @@ if (!empty($complete_user_list)) { usort($complete_user_list, 'sort_users'); foreach ($complete_user_list as $index => $user) { - $officialCode = !empty($user['official_code']) ? ' - '.$user['official_code'] : null; - $groups = $userGroup->getUserGroupListByUser($user['user_id']); - $groupNameListToString = ''; - if (!empty($groups)) { - $groupNameList = array_column($groups, 'name'); - $groupNameListToString = ' - ['.implode(', ', $groupNameList).']'; - } - - $name = api_get_person_name( - $user['firstname'], - $user['lastname'] - ).' ('.$user['username'].')'.$officialCode; + //prevent invitee users add to groups or tutors - see #8091 + if ($user['status'] != INVITEE) { + $officialCode = !empty($user['official_code']) ? ' - '.$user['official_code'] : null; + + $groups = $userGroup->getUserGroupListByUser($user['user_id']); + $groupNameListToString = ''; + if (!empty($groups)) { + $groupNameList = array_column($groups, 'name'); + $groupNameListToString = ' - ['.implode(', ', $groupNameList).']'; + } - if ($orderUserListByOfficialCode === 'true') { - $officialCode = !empty($user['official_code']) ? $user['official_code']." - " : '? - '; - $name = $officialCode." ".api_get_person_name( + $name = api_get_person_name( $user['firstname'], $user['lastname'] - ).' ('.$user['username'].')'; + ).' ('.$user['username'].')'.$officialCode; + + if ($orderUserListByOfficialCode === 'true') { + $officialCode = !empty($user['official_code']) ? $user['official_code']." - " : '? - '; + $name = $officialCode." ".api_get_person_name( + $user['firstname'], + $user['lastname'] + ).' ('.$user['username'].')'; + } + $possible_users[$user['user_id']] = $name.$groupNameListToString; } - $possible_users[$user['user_id']] = $name.$groupNameListToString; } } diff --git a/main/user/user.php b/main/user/user.php index 775e45bf70..953f2e0c29 100755 --- a/main/user/user.php +++ b/main/user/user.php @@ -74,31 +74,19 @@ if (api_is_allowed_to_edit(null, true)) { case 'set_tutor': $userId = isset($_GET['user_id']) ? intval($_GET['user_id']) : null; $isTutor = isset($_GET['is_tutor']) ? intval($_GET['is_tutor']) : 0; + $userInfo = api_get_user_info($userId); + if (!empty($userId)) { - if ($sessionId) { - /*$res = SessionManager::set_coach_to_course_session( - $userId, - $sessionId, - $courseCode, - true - );*/ - } else { - /*if (!empty($_POST['promoteCourseAdmin']) && $_POST['promoteCourseAdmin']){ - $userProperties['status'] = 1; - } else{ - $userProperties['status'] = 5; + if (!$sessionId) { + if ($userInfo['status'] != INVITEE) { + CourseManager::updateUserCourseTutor( + $userId, + $courseId, + $isTutor + ); + } else { + Display::addFlash(Display::return_message(get_lang('InviteesCantBeTutors'), 'error')); } - if (!empty($_POST['promoteTutor']) && $_POST['promoteTutor']){ - $userProperties['tutor'] = 1; - } else{ - $userProperties['tutor'] = 0; - }*/ - - CourseManager::updateUserCourseTutor( - $userId, - $courseId, - $isTutor - ); } } break; @@ -774,6 +762,8 @@ function modify_filter($user_id, $row, $data) global $is_allowed_to_track, $charset; $user_id = $data[0]; + $userInfo = api_get_user_info($user_id); + $isInvitee = $userInfo['status'] == INVITEE ? true : false; $course_info = $_course = api_get_course_info(); $current_user_id = api_get_user_id(); $sessionId = api_get_session_id(); @@ -805,7 +795,11 @@ function modify_filter($user_id, $row, $data) $text = get_lang('SetTutor'); } - $disabled = ''; + if ($isInvitee) { + $disabled = 'disabled'; + } else { + $disabled = ''; + } if ($data['user_status_in_course'] == STUDENT) {