Just a heads up for people who upgrade to Moodle 4.5 and have suspended users in their courses. It creates a massive amount of failed tasks.
See https://tracker.moodle.org/browse/MDL-84089 for more details.
We are coping with it right now.
Just a heads up for people who upgrade to Moodle 4.5 and have suspended users in their courses. It creates a massive amount of failed tasks.
See https://tracker.moodle.org/browse/MDL-84089 for more details.
We are coping with it right now.
I had a look into this but I think there's something additional causing this problem. As far as I can see the scheduled task gets the list of users via assign->list_participants()
which calls assign->show_only_active_users()
, and this function – as its name suggests – should exclude users who are either suspended or have suspended enrolments.
Do you have steps to reproduce this issue on a clean Moodle site? Also, is Show only active enrolments disabled under Site administration > Grades > Report settings > Grader report? I'm not certain this could affect this issue but it's worth checking.
So yes, I have this set.
Did you check it with this setting?
I can not check if I can reproduce it on a clean moodle. Our Moodle is very complex. Students are being enrolled and unenrolled using webservices.
Did you also check the manual enrolment with an end date and have it set to this?
So what happens for us is the following:
Do you have users enrolled on the affected course with authentication method = "No login" (auth = 'nologin' in mdl_users
)? I think that could cause this problem.
If so, a short-term fix for the queue_assignment_due_soon_notification_tasks_for_users
task could be to add lines 2383 to 2385 to mod/assign/locallib.php
:
2380 $this->participants[$key] = $sortedfilteredusers;
2381 }
2382
2383 $this->participants[$key] = array_filter($this->participants[$key], function($user) {
2384 return $user->auth !== 'nologin';
2385 });
2386
2387 if ($idsonly) {
I think I found one of the students that generates an error in this task. I can see it is a cohort enrolment.
Something strange though...
ONE entire cohort is enrolled in this course. Yet within this cohort, students have the status active and suspended.
That should not be possible right?
So what has happened here... any idea's?
All I can think of is this:
What is External unenrol action set to under Site administration > Plugins > Enrolments > Cohort sync? I think either "Disable course enrolment" or "Disable course enrolment and remove roles" will cause an enrol_cohort participant to show as Suspended when that user is removed from the cohort.
However, as far as I can see assign->list_participants()
does correctly exclude such users so I don't think these users would cause the task failure.
I was mistaken when I said assign->list_participants()
excludes suspended users. The get_enrolled_...()
functions refer to the suspended status but this refers to suspended enrolments, not suspended users.
So the queue_assignment_due_soon_notification_tasks_for_users error can be resolved by editing mod/assign/locallib.php
to add lines 2353 to 2355 below (in list_participants()
):
2349 $params = array_merge($params, $keywordsparams);
2350 }
2351 }
2352
2353 if ($this->show_only_active_users()) {
2354 $additionalfilters .= " AND u.suspended = 0";
2355 }
2356
2357 $sql = "SELECT $fields
2358 FROM {user} u
This may not the correct solution since it changes list_participants()
to treat users suspended at site level the same as users with suspended enrolments – which makes sense to me, but I'm not a teacher or admin. (An alternative approach would be to pass a flag to list_participants()
to specify whether users suspended at site level should be included).
The above change should also fix queue_all_assignment_due_digest_notification_tasks but I haven't tested this yet.
Thank you, Richard! I think you are right!
How can you disable the notification while there is a solution?
Thank you, Richard! Have a nice day!