Moodle Plugins directory: Inactive User Cleanup | Moodle.org

Inactive User Cleanup
Automate the process of removing inactive users from your site using Inactive User Cleanup. Each inactive user will receive a customized email as per predefined inactivity dates before account deletion.
Note: The cleanup process is run by the Moodle cron, so while Moodle removes the clutter, this solution cleans up the inactive learners for your courses.
Add Interval Time - You can set an interval time for your students before thay get automatically removed during the cleanup. Learners will receive an email requesting the deletion of their accounts if the interval time exceeds the limit you've set.
Check and Assess Timestamp - An interesting feature of this solution is that is compares the last activity time with the present time. The deletion process begins if the interval between the two timestamps is longer than what has been set.
Send Notification Email - Another unqiue feature of this solution is that that whenever before deleting an inactive accounts students get notifies about the deletion process. This gives them the opportunity to reactivate their account.
Hassle-Free Cleanup - This is such a simple and easy solution, you can avoid having to manually go through and delete each account.
Try out this efforless way of cleaning up your inactive users.
Do keep us posted.
Exception occurred while calling tool_inactive_user_cleanup\privacy\provider::get_contexts_for_userid.
This means that plugin tool_inactive_user_cleanup did not complete the processing of data. The following exception information may be passed on to the plugin developer:
ERROR: Incorrect number of query parameters. Expected 3, got 2.
#0 /home/xxx/public_html/lib/dml/mysqli_native_moodle_database.php(1331): moodle_database->fix_sql_params('\n ...', Array)
#1 /home/xxx/public_html/privacy/classes/local/request/contextlist.php(71): mysqli_native_moodle_database->get_recordset_sql('\n ...', Array)
#2 /home/xxx/public_html/admin/tool/inactive_user_cleanup/classes/privacy/provider.php(148): core_privacy\local\request\contextlist->add_from_sql('SELECT c.id\n ...', Array)
#3 /home/xxx/public_html/lib/moodlelib.php(8292): tool_inactive_user_cleanup\privacy\provider::get_contexts_for_userid(41872)
#4 /home/xxx/public_html/privacy/classes/manager.php(578): component_class_callback('tool_inactive_u...', 'get_contexts_fo...', Array)
#5 /home/xxx/public_html/privacy/classes/manager.php(611): core_privacy\manager::component_class_callback('tool_inactive_u...', 'core_privacy\\lo...', 'get_contexts_fo...', Array)
#6 /home/xxx/public_html/privacy/classes/manager.php(238): core_privacy\manager->handled_component_class_callback('tool_inactive_u...', 'core_privacy\\lo...', 'get_contexts_fo...', Array)
#7 /home/xxx/public_html/admin/tool/dataprivacy/classes/task/process_data_request_task.php(93): core_privacy\manager->get_contexts_for_userid(41872)
#8 /home/xxx/public_html/lib/classes/cron.php(508): tool_dataprivacy\task\process_data_request_task->execute()
#9 /home/xxx/public_html/lib/classes/cron.php(302): core\cron::run_inner_adhoc_task(Object(tool_dataprivacy\task\process_data_request_task))
#10 /home/xxx/public_html/lib/classes/cron.php(128): core\cron::run_adhoc_tasks(1726563604, 0, true, 1726563602)
#11 /home/xxx/public_html/admin/cron.php(80): core\cron::run_main_process(0)
#12 {main}
Thanks in advance.
Mark
Our team is looking into this. For now you can track the issue from here - https://github.com/dualcube/moodle-tool_inactive_user_cleanup/issues/29
For example, part of our school policy is if you get caught plagiarizing, or you accumulate and max out the set number of demerits/marks (scoring system for rule-breaking), or are excessively hostile to school staff, you're suspended for a certain length of time based on the severity of the infractions. (And would be outside the timeframe I use to remove inactive users.)
And, we have a few accounts that only get used periodically (often outside of the timeframe I use for manually removing idle users), plus a couple I use as "sample" students for testing features and making tweaks.
I DO NOT want those to ever get deleted. So this would be great, if there were a way to say "exclude these users from the deletion process." Is that doable? Or in the works?
Like I said, this would save me so much work in the user maintenance "department", and I wouldn't have to mess with csv files with user data (and "shredding" it later) like I'm currently doing.
To ensure you receive the best assistance, I kindly recommend reaching out to our development team directly via this link:https://dualcube.com/contact-us/. They will be able to provide you with more detailed support.
Please ensure you're using the latest version from GitHub, as there doesn't seem to be an error at that line. I recommend uninstalling your current version, installing the updated one from GitHub, and checking again.
Let us know how it goes.
2.7.2 2.7.4 and 2.7.5 are all apparently compatible with my Moodle 4.1
However, when I try 2.7.5 (and the Githib master version), I see:
Plugin Version: 2025010900
Required Moodle version: 2022112815
Installation Aborted due to validation failure
My Question: Should I try 2.7.4 or 2.7.2 - which will work for me?
Thank you for any guidance you can give.
In order to use the latest version of Inactive User , you need to use Moodle version 4.1.15 . So kindly update Moodle and then update the plugin.
Please do keep us posted.
My version of Moodle is 4.5.3 with PHP 8.1
Each day, I can see in my log file the same message "PHP Warning: Attempt to read property "date" on bool in /public_html/moodle/admin/tool/inactive_user_cleanup/classes/task/tool_inactive_user_cleanup_task.php on line 79"" more than 100 times.
Thanks in advance
Kindly update the plugin and check.
we have a problem with your tool.
The settings are 2555 days for inactive days and 1 day for send e-amil for user tests.
The cron-job runs with In the last cron-job 0 users were archived.
In the last cron-job 0 users were deleted.
In the last cron-job 0 users were reactivated.
No problems occurred in plugin tool_cleanupusers in the last run.
However, users who have not logged in for more than 7 days will not be deleted.
Can you help us, please.
We checked the plugin configuration and the reason users are not being deleted after 7 days is due to the current settings:
Days of inactivity: 365
Days before deletion: 10
With this setup, a user is only marked as inactive after 365 days without login. After that, they are deleted 10 days later (on day 375).
This means users inactive for just 7 days will not be affected.
If you want users to be deleted after 7 days of inactivity, please update the settings as follows:
Days of inactivity: 7
Days before deletion: 1 (or adjust as needed)
This way, users will be considered inactive after 7 days, and then deleted the following day.