Invalid course module ID when removing users

Invalid course module ID when removing users

by Miriam Bérubé -
Number of replies: 2

Hello,

I am currently running Moodle 3.6 on my site. I recently had installed, used and then uninstalled a few plugins on one of the main courses of the site. Therse were:   Checklist (activity), Checklist (block), Checklist (grading method) and Checkmark.

These did not work with my Moodle site and caused problems exporting grades.  I had removed them and had encoutered "invalid course module ID" when removing a single user profile.   If I hit the back button, it allows me to delete the profle. 

For bulk removals (either bulk user actions or csv file) I get "error reading from the datatbase." But I am able to remove the profiles by hitting back and resubmitting the request the same amount of users to be removed.

For site uploads (by CSV) it gives the same message "error reading from database."  It only happens with the one course.  I can remove and add users to other courses without issue. 

Does someone have any insights to fix the problem?

Thx!


Average of ratings: -
In reply to Miriam Bérubé

Re: Invalid course module ID when removing users

by Randy Thornton -
Picture of Documentation writers
Miriam

Because some of these, such as the Checklist activity, are course modules, they will have entries for users who used them. Since the module itself has been deleted from the site, there's a missing course module id in the database. Basically, there still exists a reference to the module in the record of what the student did, but there's no module anymore for it to refer to. When deleting the user, it is trying to clean out such references and gets stuck because it can't find the module referred to.

I think two things:

1) Did you first unenroll the student from the course? If the activities behave as they should, when a student is unenrolled, they should clean out that activity data. Should, anyway. Try that and see if that helps if you did not already.

2) For modules in a site that may have data in use, I usually prefer to simply disable them rather than uninstall them if no longer using them. Sometimes this is not always possible (for example when upgrading and the plugin may be too old, or if it is tossing out big errors), but generally having it sit there disabled is okay and helps to retain the data integrity meanwhile.

Randy
Average of ratings: Useful (2)
In reply to Randy Thornton

Re: Invalid course module ID when removing users

by Miriam Bérubé -
Randy,

This does make sense. I have encountered this same problem before when upgrading content previously. I figured it was this, but wanted to check. I had to remove the plug-ins as they were causing my site to crash, so it was not possible to disable (I actually had to go into the server and remove one plugin this way and uninstall the other ones from the site, as they were dependent on the main). The other problem I have is that this course is in continuous use. Students start and stop the training at different times, so I constantly need to add and remove profiles. That's why I use bulk user creation and course enrollment with a CSV file. I can also remove users in bulk this way.

The checklist activities may not have been accessed by the students. I was testing it to see if I could set up different sets of requirements for different groups of students within the same course (for different provincial requirements). Thought that activity might help. Ran the checklist report and it crashed. When I removed an activity previously, it gave me an error messsage until all the profiles were removed that were active during the time when the activity was present. I may consider reinstalling the activity and disabling it. Do you think that may help?