This commit is contained in:
Sam Hemelryk 2014-12-09 15:38:40 +13:00
commit d5265ac28e

View File

@ -1967,9 +1967,10 @@ class assign {
*
* @param int $groupid The id of the group whose members we want or 0 for the default group
* @param bool $onlyids Whether to retrieve only the user id's
* @param bool $excludesuspended Whether to exclude suspended users
* @return array The users (possibly id's only)
*/
public function get_submission_group_members($groupid, $onlyids) {
public function get_submission_group_members($groupid, $onlyids, $excludesuspended = false) {
$members = array();
if ($groupid != 0) {
if ($onlyids) {
@ -1991,7 +1992,7 @@ class assign {
}
}
// Exclude suspended users, if user can't see them.
if (!has_capability('moodle/course:viewsuspendedusers', $this->context)) {
if ($excludesuspended || !has_capability('moodle/course:viewsuspendedusers', $this->context)) {
foreach ($members as $key => $member) {
if (!$this->is_active_user($member->id)) {
unset($members[$key]);
@ -6673,7 +6674,7 @@ class assign {
$groupid = $group->id;
}
}
$members = $this->get_submission_group_members($groupid, true);
$members = $this->get_submission_group_members($groupid, true, $this->show_only_active_users());
foreach ($members as $member) {
// User may exist in multple groups (which should put them in the default group).
$this->apply_grade_to_user($data, $member->id, $data->attemptnumber);