Suspended users show 'active' in previously enrolled courses

Suspended users show 'active' in previously enrolled courses

by Jarrad Gisk -
Number of replies: 35

Hi there,


We're a charity and are looking to use Moodle to manage our internal learning and development for staff and volunteers. We have AD sync setup to create new users and suspend them when the accounts are disabled/removed. This is working as expected.

We want all of our users to be enrolled in certain courses, so I had thought to accomplish this via an 'allusers' cohort. But on testing I noticed that when an account becomes suspended, its enrollment on the course remains 'active'. I had expected it to be 'inactive' once the account was suspended.

I've tried this with manual enrollment, too, but suspended accounts still show 'active'.

I appreciate manual enrollments can be manually suspended (but not cohort sync enrollments?), but shouldn't suspended accounts automatically have their enrollments made 'inactive'? This would seem to be the expected behaviour, as described here:

Suspended users currently still appear in the gradebook but a teacher can select in their Grader report preferences to show only active users or all users (including suspended users).

This is exactly what I'm aiming for - to save grades for suspended users, but to have them set inactive on the course to easily differentiate current staff and volunteers from those who've left.

Am I missing something?

Average of ratings: -
In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers

Suspending a student only removes there access to your Moodle site, it does not remove their enrollment from any course or their activities from the Grade book.

Having only a suspend option is somewhat problematic for business use - as we have "students" for many years that have leave of absence (LOA). We also need to retain training history for students that are no longer in our employment.

IMHO -

Would be nice to have an Active and Inactive option, with the Inactive removing all current enrollments.

All delivered reports and grade book should have filtering options for Active/Inactive students.

 

Average of ratings: Useful (1)
In reply to Shirley Gregorczyk

Re: Suspended users show 'active' in previously enrolled courses

by Jarrad Gisk -

Hi Shirley,

Thanks for the reply. I understand suspended users won't be unenrolled; we actually don't want them to be! But I understood their enrolment status would change to 'inactive' to match their suspended user status.

Is this not the case? How do you handle excluding from the monitoring students who're no longer in your employment?

I've not actually looked into the reporting yet, so perhaps it isn't an issue... but given the statement on the site:

Suspended users currently still appear in the gradebook but a teacher can select in their Grader report preferences to show only active users or all users (including suspended users).

I was expecting to be able to easily filter out the suspended users?

Thanks,

Jarrad


In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers

We are using competencies and learning plans, as we need completion dates/times vs grades for our "students". I am not the best resource for how the grade book works.

I must un-enroll our "students" that leave our employment from each course (this is a double-digit number for most students) for our completion metrics.


In reply to Shirley Gregorczyk

Re: Suspended users show 'active' in previously enrolled courses

by Jarrad Gisk -

Thanks, Shirley. That's very helpful. I've been having a play with competencies and learning plans and think this might be the way to go. I'm thinking we'll relist compentencies and learning plans yearly, so this year we'll have an IG-2018 compentency linked to the CORE 2018 learning plan all staff need to complete, and next year we'll replace this with a new IG-2019 competency on a new CORE 2019 learning plan for all staff.

I've found how to configure Moodle to assign competencies when a course is completed, but I'm having trouble finding a report that lists all users and their competencies so we can chase staff.

How do you manage tracking which users have/have not completed various competencies? The only way I seem to be able to find is by looking up individual users. I was hoping there was an easy way to get a list of active users and show which compentencies they have.

I've noticed there are a couple of third-party plugins, but I'd like to stear clear of these, as there's no guarantee they'll be maintained long-term and future updates to Moodle could break them.

In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers

You are correct the reporting is not designed for business use. Pulling training data out of an LMS for a student last semester is much different than having an employee that has worked for 10 years at a company.

There are some Moodle Trackers that look promising https://tracker.moodle.org/browse/MDL-62131


In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Melanie Scott -
Picture of Particularly helpful Moodlers

Suspending users (even individually and directly--set to inactive--in courses) will not remove them from the gradebook.  Or enrollment lists or anything.  sad

I feel your pain.  Have for years now.

Average of ratings: Useful (1)
In reply to Melanie Scott

Re: Suspended users show 'active' in previously enrolled courses

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Melanie,

In the course on Grades > Setup > Preferences: Grader report, in the General section, do you have, Show only active enrolments set to, Yes? Then go to course edit > More... > Users > Enrolled users, and changed the student in question from Active to Suspended? These steps work for me in removing them from view in the gradebook..

Average of ratings: Useful (3)
In reply to AL Rachels

Re: Suspended users show 'active' in previously enrolled courses

by Melanie Scott -
Picture of Particularly helpful Moodlers

Sure.  You can do that....but if you're working with several hundred courses and each exiting employee is enrolled in 20 courses?  Not practical at all.  It isn't super relevant for me now...but that's what I used to deal with, so I get the frustration.  And...the site I used to manage had, at any given time, something like 5,000 active users--this does not include the 12,000+ inactive accounts.

Average of ratings: Useful (1)
In reply to Melanie Scott

Re: Suspended users show 'active' in previously enrolled courses

by Jarrad Gisk -

Hi Melanie,

And the thing is I don't even want to remove their enrolment, but to have them displayed as 'inactive' in the course so we can easily distinguish leavers in reports. I find it really strange that a user account can be 'suspended', but their enrolment displays as 'active' and the user appears in it as such.

I can't think of a reason why a suspended user should have active enrolment, but assuming there is, perhaps Moodle could introduce a question on how to handle enrolments when manually suspending a user and an option when configuring a cohort sync: a) leave all enrolments active, b) deactivate  all enrolments, c) delete all enrolments.

Jarrad


Average of ratings: Useful (1)
In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Melanie Scott -
Picture of Particularly helpful Moodlers

If it isn't too labor intensive...you could try Al Rachel's solution.  When I needed that, it would not have been practical.  But if you only have a few courses and not a huge body of students, it might suit your needs.

In reply to Melanie Scott

Re: Suspended users show 'active' in previously enrolled courses

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Before I retired, I always handled enrollment for my students with a CSV file. Anytime during the school year, if I needed to make a change, it was easiest to make the change in my CSV file and upload it again. Careful use of the upload options made it so only the "new" changes were utilized.

One of the CSV options that can be used to fit this case is, enrolstatus#. "enrolstatus# is optional as by default all newly enrolled users are set to active. If used a value of 1, it will suspend users in the course and if a user is previously set as inactive / suspended then a value of 0 will unsuspend them and make them active again."

So, if my CSV file has a column, course1, and I add a column of, enrolstatus1, I can do a mass suspend or active change in just a few moments by setting a 1 or 0 in each row of my file.

Average of ratings: Useful (3)
In reply to AL Rachels

Re: Suspended users show 'active' in previously enrolled courses

by Jarrad Gisk -

Hi Al, Melanie,

I don't believe CSVs would be pratical for us, as we constantly have staff and volunteers coming and going and need a solution that'll be scalable with multiple courses (we've launched just with GDPR, but will be adding safeguarding, health and safety, and other core courses before long).

We're currently using cohorts to manage auto-enrolment into the course and will use it for other courses, too. As far as I'm aware, you can't manually suspend enrolments, as this is handled by the cohort sync. Even if we could, that's adding a lot of manual management the more courses we add, so I don't think this is the way to go. I really need a way to have multiple courses updated easily.

Yesterday I realised that I could config the enrolment sync to stop unenroling users removed from the cohort and instead just suspend their enrolment, but this also removes their role. I found this means they don't appear in the gradebook, even if you switch the option to show all sutdents, not just active.

I did find that I could still open this suspended/no role user from the participants screen and view their actual grade, so this might be good enough for us to 1) be able to monitor course completion for active students (and not have the leavers show on the report) and 2) still be able to view historical grades for leavers should we get an enquiry after they've left.

I also found I could manually add the student role back to the suspended enrolment, which meant they then did show in the grade report when the filter was set to show inactive students, too. But this is too manual and isn't scalable, so won't be practical. It would be nice if the cohort sync included a third option to suspend but not remove roles.

I'm not sure if I adequately explained what we're trying to accomplish:

We're going to be adding all our core training to Moodle and need a way to monitor that active staff/vols are completing their required courses in a timely way.

We're using LDAP and external database syncs to auto-create and suspend user accounts.

We're manually adding new users and removing leavers from the cohort via a manual daily check (we run a search for active users that aren't in the cohort to bulk add, and a separate search for suspended users who are in the cohort to manually remove them (unfortunatley not available via bulk action, but individually searching in the cohort itself). I believe there's a third-party plugin for auto-enroling to a cohort, but I'm not keen on using it, as it might lose support.

We need to be able to easily generate a report of active users and their status of the required training (just GDPR for now) that doesn't include suspended users, but we also need to be able to hold and access their history even after they leave per our records retention policy for personnel and volunteer records.

I was considering competencies, but as far as I can tell there's no built-in report to generate a list of active users and their compentencies. I could build an external report via SQL, but am trying my hardest to see how to manage this entirely via Moodle.

We also need staff/vols to retake these same courses annually. I was really hoping to find a way to do this per person (e.g., they get a reminder 11 months after last completion to do the course again), but it's looking like the only way to accomplish this entirely within Moodle is to 'reset' the counter for everyone at the same time (e.g., republish the course annually and switch the cohort to drop the old and add the new course).

It would really be ideal if we could run site-wide reports on course completion, but I'm not seeing this as possible in Moodle. As far as I can tell, the reports need to be run against individual courses.

Sorry, I know this is a bit of a ramble, but I'm trying to work through how to best manage this when staff/vols come and go every day and everyone needs to complete the same courses annually. New to Moodle, so lots to digest!

Average of ratings: Useful (1)
In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Sorry, can't be more helpful. As to, "ideal if we could run site-wide reports on course completion" - Have you looked at the, Ad-hoc database queries plugin? There are a number of contributed reports for it regarding Course Completion. There are 10 in the category and more than one of them looks like it will provide what you want.

In reply to AL Rachels

Re: Suspended users show 'active' in previously enrolled courses

by Melanie Scott -
Picture of Particularly helpful Moodlers

Yes!  I used to use Configurable Reports.  very helpful.  And you can add a student transcript which people really like (maybe less now that the dashboard is cooler (cooler than 2.8).

In reply to AL Rachels

Re: Suspended users show 'active' in previously enrolled courses

by Jarrad Gisk -

Thanks and sorry for the delay in getting back. Yep, I've seen that plugin, but I'm trying my hardest to steer clear of plugins that aren't developed by the Moodle team, as they could be pulled at any time and could interfere in the future upgrade process. (The Moodle team might themselves remove certain features , but I'd hope they'd go through a period of deprecatation for a few upgrades to give you time to find alternatives.)

The ad hoc queries plugin is a way to put your own custom SQL queries into Moodle. If we end up having to go the route of custom SQL queries, I'll probably just put them directly on our SSRS report server to make a clear distinction between the built-in Moodle features and our customisations.


In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Melanie Scott -
Picture of Particularly helpful Moodlers

Not a bad idea, especially since I recently learned Configurable reports is unsupported currently (since 3.1)...because Moodle HQ hired the developer to do something else smile.  That said, Ad Hoc reports is okay--it isn't as fancy but it does the job if you know sql.

In reply to AL Rachels

Re: Suspended users show 'active' in previously enrolled courses

by Reginaldo Polesi -

If you have the same user enrolled in several courses, simply use the following fields

username - firstname - lastname - suspended - enrolstatus1 - course1 - enrolstatus2 - course2

And you can even mark "0" for one course and "1" for another course.

You can leave the student active on the site and inactive in some or all courses. He will then be able to log in, but will not be able to access the courses.

Anyway, from the combination of "suspended" and "enrolstatus1" can do anything with the student's registration.

In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -
I agree with your sentiment about suspending users but remaining active in a course.
I have begun to incorporate cohorts into our system.  However, I have found that once a student is placed in a cohort and cohort sync is set up for a course, you cannot manually change any setting set by the cohort sync.  For us, the initial grouping is temporary and the students are moved to a final group based upon the needs of the instructor.  However, once a group is set in the cohort sync, it is fixed.  So I changed the cohort sync group to none, but that sort of defeats the purpose of using cohorts as now I or the instructor must go and put the student into the temporary group.
Cohorts make enrolling students in multiple courses easy (I also do not forget one when adding new students). But, I am starting to get the feeling cohorts are more trouble than they are worth.
I have also just discovered the same applies to suspending (inactivating) a users access to a course. Again, defeating the purpose of using cohorts. I do not want to create a bazzilion and one cohorts to fit all combinations.  I guess I could remove the student from the cohort, but that also unenrolls them from any other course.
Is there a way to have the only fixed item in cohort sync to be membership in the cohort and all other options in the cohort sync allow manual overrides?

Thank your for any assistance anyone can provide.
In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

Hi. 

A way my school attempts to handle this -- when a user is 'suspended' at the site level (for what ever reason), we update the user's last name by adding (Inactive) at the end. When a teacher sees this in their gradebook, they then know to suspend the user at the course level. 

Takes a lot of manual work but it's been pretty effective. Then, the teachers do not see these inactive users in their gradebooks but their work is retained. 


If you enroll someone via cohort sync and inactivate them at the site level, then no, they will not be automatically inactive at the course level. Removing them from the cohort will remove them from the courses that cohort is enrolled in. Im not sure you can manually suspend a user enrolled via cohort sync but you can check the docs on that.

Average of ratings: Useful (2)
In reply to John Provasnik

Re: Suspended users show 'active' in previously enrolled courses

by Rainer Schaufelberger -

Hi

I have a similar problem:

We have an account for our bachelor students. After finishing their studies we set the account "suspended". When a former bachelor student apply for further studies later he gets a new account.

When you want to enrol the student to an new course in the further studies you have no idea what account you should use because their is no chance to see which account is the active:

enrolment

At least, I think everybody agrees, you should be able to see if an account is "suspended".

I think this is not a nice feature to have, it should have been implemented the first time.

I hope to find this information in one of the future updates.

Thanks Rainer


In reply to Rainer Schaufelberger

Re: Suspended users show 'active' in previously enrolled courses

by eLearning FedTraining -

Hi Rainer,

If you want to try these lines of code,

$user->picture = $OUTPUT->user_picture($user, $useroptions);// existing code
$u = $DB->get_record('user', array('id' => $user->id), 'suspended', MUST_EXIST); // additional
($u->suspended) ? $s=' - suspended at site' : $s=''; // additional
$user->fullname = fullname($user, $viewfullnames).' '.$s; // additional + existing code
$fieldvalues = array(); // existing code

...from line 86 in \enrol\manual\ajax.php

Not thoroughly tested!

- Matt

In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -

I just noticed the reversed is also a potential issue.  By that I mean, when a user is suspended in a course, that course no longer appears in the list of enrolled courses in the users profile.

The course list in the user's profile shows those courses they are enrolled in.  When they are suspended in a course, they are still enrolled,  However, the suspended course does not appear in the list of enrolled courses.

Since the user's suspended course no longer shows up in their profile, how is someone to know to reactivate that user in a course they do not know/remember they are enrolled in when they return.  I am in the corporate environment and have people leaving and returning all the time.

Below image is from a user's profile before suspending them in a course.


Below is an image from the same user's profile after suspending from the first course.


Is this me just not having the correct parameters selected, a bug, the way it is supposed to be, or a Microsoft-type "feature"?

Is there another way of seeing all courses a user is enrolled in?

In reply to Al Henneberger

Re: Suspended users show 'active' in previously enrolled courses

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers

If a course is "suspended", I would interpret that to mean the course is inactive (retired/superseded by revision). If this is true, then students should no longer be enrolled in those courses. You may need to report on a student's past course completions, but they should no longer be assigned or enrolled in inactive courses.


In reply to Shirley Gregorczyk

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -

Sorry, perhaps I misspoke or had a spate of fat-finger syndrome, but I meant the student is suspended in the course, not the course itself.  

If I suspend student A in course 1, then course 1 will now not appear in student A's profile listing of courses.

I disagree with your statement.  If they are no longer enrolled then their data from that course are no longer available.  But, if they are enroll and just suspended, then the data are available.

In reply to Al Henneberger

Re: Suspended users show 'active' in previously enrolled courses

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers

If a student's is no longer enrolled, their grades are still retained the Grade History report, you just need to set you date parameters back to the student's enrollment. 

In reply to Shirley Gregorczyk

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -

I have not used grade history, so was unaware of this.  I will have to investigate and see if we can use it.

Thanks.

In reply to Al Henneberger

Re: Suspended users show 'active' in previously enrolled courses

by Alex Sandu -

Hi, Al Henneberger

For your question:

FILE: moodle/lib/myprofilelib.php

LINE 230:

...

if (!isset($hiddenfields['mycourses'])) {
        $showallcourses = optional_param('showallcourses', 0, PARAM_INT);
        if ($mycourses = enrol_get_all_users_courses($user->id, true, null)) {

...

You must change the second parameter of function "enrol_get_all_users_courses" from TRUE to FALSE.

In reply to Alex Sandu

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -

Thank you for your response.

While your solution may be the answer to my issue, I do not have access to the php files, even though I am the Administrator.  IT has prevented such access.

Before I try to get IT to modify the php files, I do have questions.

  1. Basically, what does this Boolean change do?
  2. Is this a modification that would have to be redone every time we upgrade?
  3. Is there a way to do this through one of the Administrator settings?

Again, thank you for your solution.

In reply to Al Henneberger

Re: Suspended users show 'active' in previously enrolled courses

by Alex Sandu -

1. if it is TRUE, then the function will return all courses in which the user is enrolled, with the following restrictions:
  • the status of the user enrollment is not SUSPENDED,
  • the instance of the enrollment method is ACTIVE,
  • time-start of user enrollment is in the past,
  • time-end of user enrollment does not exist OR is in the future.
2. yes
3. not because it is hard coded, at least until now


Average of ratings: Useful (1)
In reply to Alex Sandu

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -

Thank you for your response, Alex.

I'll see if I can talk IT into making the change.

In reply to Jarrad Gisk

Re: Suspended users show 'active' in previously enrolled courses

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

There is a difference between suspended status and active status. 

Suspended status is like getting suspended from school: you're still an active student at the school, but you're temporary suspended from participating (ie logging into the site). Suspended status is a site level context, not a course level context  

Inactive status is set from a course by course context. Suspended status at the site level does not automatically make users inactive at the course level as this can hide their grades from the teacher. 

For manual enrollments, you can suspend and inactivate at the same time, but you have to know what classes the user is in (a student information system is useful here). I've attached a sample spreadsheet of how I manually both suspend and inactivate a users. 

In reply to John Provasnik

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -

Ok, now I am really confused.

In course enrollments I have the following:


While in the students profile I have:


Based on your post, my first image should be Active and Inactive in the drop down.  Is this a versioning issue?  I am running 3.5.3.

I initially made bulk enrollments similar to what you do with the Excel files, but, that got too cumbersome.  So I created a database.  The database makes it easy for me to create new accounts and enroll in multiple courses, add enrollments, change profile parameters, and also creates the csv file for upload.

Unfortunately, without Alex's change (above) when a student is Inactivated (Suspended) in a course that course is removed from their profile's course listing.  Thus making it difficult to determine what courses a student was enrolled in if/when they return.  I could add the functionality you have in your Excel files to the database, but I have not had the time to do that yet.  That, and I did not know the field names until now.

In your files, what are the allowed parameters for fields 'enrolstatus1', 'auth', and 'suspended'?  For the first and last, I am guessing 0 and 1 or 1 and 2 where 1 is inactive/Suspended and 0 or 2 are Active.  For the 'auth' field, however, I could make some SWAGs but would rather not.  Are these fields ones you created or are they already part of the "system"?

In reply to Al Henneberger

Re: Suspended users show 'active' in previously enrolled courses

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

Oh, I had forgotten I changed my language string to make the language different at the course level (because it was confusing overall). I made it say "inactive" as the course level (instead of suspended) as to not confuse it with the site level "suspension"


0 and 1 are the only allowable options (not 2) for those columns; these are  part of the manual account creation CVS fields, they are not custom. 

In reply to John Provasnik

Re: Suspended users show 'active' in previously enrolled courses

by Al Henneberger -

No problem.  And I agree completely about the confusing part.  I just made a similar change to my language pack.  This differentiation should be in the language pack to begin with.

Unfortunately, documentation for the fields and allowed options is sparse, but getting better from when I first looked with 2.5.

Thanks for the response.