Index: lib.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/choice/lib.php,v retrieving revision 1.59.2.9 diff -u -r1.59.2.9 lib.php --- lib.php 16 Jan 2008 18:49:42 -0000 1.59.2.9 +++ lib.php 17 Jan 2008 22:25:11 -0000 @@ -328,6 +328,8 @@ $users = get_users_by_capability($context, 'mod/choice:choose', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber', 'u.firstname ASC', '', '', $currentgroup, '', true, true); + $allusersnothidden = get_users_by_capability($context, 'mod/choice:choose', 'u.id', 'u.firstname ASC', '', '', $currentgroup, '', true, false); ///MDL-12331 ugly hack to prevent hidden users from being displayed in the unanswered column. needs fixing! + if (!empty($CFG->enablegroupings) && !empty($cm->groupingid) && !empty($users)) { $groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id'); foreach($users as $key => $user) { @@ -422,7 +424,10 @@ // MDL-7861 echo ""; foreach ($userlist as $user) { - if ($optionid!=0 or has_capability('mod/choice:choose', $context, $user->id, false) AND !($optionid== 0 AND has_capability('moodle/site:doanything', $context, $user->id, false))) { + if ($optionid!=0 or has_capability('mod/choice:choose', $context, $user->id, false) AND //only get enrolled users that have access + !($optionid==0 AND has_capability('moodle/site:doanything', $context, $user->id, false)) AND //remove doanything users + !($optionid==0 AND isset($allusersnothidden))) { //MDL-12331 ugly hack part 2 + $columncount[$optionid] += 1; echo ""; if (has_capability('mod/choice:readresponses', $context) && $optionid!=0) { @@ -514,7 +519,10 @@ } $column[$optionid] = 0; foreach ($userlist as $user) { - if ($optionid!=0 or has_capability('mod/choice:choose', $context, $user->id, false) AND !($optionid== 0 AND has_capability('moodle/site:doanything', $context, $user->id, false))) { + if ($optionid!=0 or has_capability('mod/choice:choose', $context, $user->id, false) AND //only get enrolled users that have access + !($optionid==0 AND has_capability('moodle/site:doanything', $context, $user->id, false)) AND //remove doanything users + !($optionid==0 AND isset($allusersnothidden))) { //MDL-12331 ugly hack part 2 + $column[$optionid]++; } }