Admin tools: Inactive User Cleanup

Maintained by Picture of Arindam GhoshArindam Ghosh, Picture of DualCube TeamDualCube Team
This plugin deletes inactive user accounts. This cleanup process runs with Moodle cron job.
152 sites
34 fans
Current versions available: 2

In the first step admin user of the site setup days of inactivity and drafting notification mail for all users from the Site administration > Reports > Inactive User Cleanup

If an inactive user is found he/she gets a notification mail.

In second step if the user still has not accessed the moodle site within the time span which is mentioned in the notification mail. Then the deletion process starts. The particular inactive     user account entry is removed with next run of this cleanup process which is automatically or manually run by cron process.


Some setting is require for this cleanup process.

Setting Panel

Days of Inactivity is set by the admin user.

Days Before Deletion is set with zero when admin just wants to notify the inactive user for access the site i.e. in first step. After that when user wants to run cleanup process then Days Before Deletion will set by the admin user.

Email setting

Admin user must set the subject and body text of the email.

Cron process

Admin user run cron job manually from http://<moodlename>/admin/cron.php


Admin can uninstall this admin tool from Site administration > Plugins > Admin tools > Manage Admin Tools


  • DualCube


After years of not getting it just right, our excellent design and development team combined craft, care, love and experience to deliver two impeccable Moodle Themes i.e “Nalanda” and “University” , blend with a smooth and rich UI.

It was mostly our clients who inspired us for this venture. Their constant feedback and appreciation led us to build this for the countless Moodle lovers.

You can view the demo of Nalanda here:

** Much awaited Dark mode is coming with the new update.

You can view the demo of University here:

We also have a premium version of the MooWoodle plugin ( on Dualcube with Single Sign-On feature.

This is to be installed in Moodle.

To get any of these products:

Please any product or service related query contact us on

Thank you.


Screenshot #0


Picture of Arindam Ghosh
Arindam Ghosh (Lead maintainer)
Picture of DualCube Team
DualCube Team: Developer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of DualCube Team
    Fri, Dec 8, 2017, 2:30 PM
    Hi! Yoel,
    Please install the latest version of the plugin and clear the cache.
    Thank you.
  • Picture of Nermin Elkasovic
    Thu, Mar 15, 2018, 6:30 PM
    This has been reported a few times already. I am wondering why the plugin is still sending out emails immediately after installation without ability to control that? We have thousends of users and now we got a lot complaints. I deleted the plugin immediately too.
  • Picture of DualCube Team
    Fri, Mar 16, 2018, 9:04 PM
    Hi!! Nermin,
    Thanks for reaching out to us.
    We are sorry for the inconvenience that you experienced.
    This cleanup process runs with Moodle cron job. And the email sent to the Inactive user depends on of your time interval of cron job of your server.

    Please go to Site administration / ► Reports / ► Inactive User Cleanup / ►set the "Days Of Inactivity" and "Days Before Deletion" fields as per your requirement.

    For more details:

    Hope it helps!
    Thank you.
  • Picture of Olli Savolainen
    Thu, Sep 6, 2018, 11:01 PM
    It is quite easy to modify the source code such that this plugin does not send any emails but only deletes users after a period of inactivity. The relevant lines are in lib.php:52-60 and if you want to remove the email related form fields, they are in email_form.php:40-49.
  • Picture of Simon Lewis
    Thu, Feb 14, 2019, 8:30 PM
    I've had a couple of issues on installation on to my test moodle (v3.5). Firstly there was an error message in the installation. It said Wrong PATH attribute in XML file. So in admin\tool\inactive_user_cleanup\db\install.xml file I changed line 2 from PATH="tool/inactive_user_cleanup/db" to PATH="admin/tool/inactive_user_cleanup/db". This made the installation work, although I don't know if it will affect other things.
    Secondly, on installation it deleted and emailed nearly all users apart me and the admin user. It's on a test site, so not the end of the world, but how can I get the users back and more importantly not make that happen if I re-install it again?
    thanks, Simon
  • Picture of DualCube Team
    Fri, Feb 15, 2019, 1:34 PM
    Dear Simon,
    Firstly, the changes in the path will not affect other things and secondly, if you make no change in the inactive user's setting and run the cron, it will not remove any user.
    It will remove the user if you set the specified date or time in inactive user's settings and if the user is inactive in that period.
    Lastly, the removed user will not be recovered as there is no option available in Moodle.

    Thank you.
  • Picture of Simon Lewis
    Wed, Feb 20, 2019, 7:49 PM
    Thanks for the reply but it didn't solve it. It still ran the scheduled task on plugin installation (tried many times), and deleted pretty much all users. It also deleted a user when first registering on the site, before there was a chance to confirm the registration. It seems to look at the last access field and was deleting users with a last access of 0, which caused conflict with new users created by LDAP, if they hadn't had a chance to access before the task was run then it deleted them.
    I'm having too many issues with it, so can't risk it on live unfortunately.
    thanks anyway, Simon
  • Picture of Hans Beck
    Wed, Feb 27, 2019, 4:19 PM
    Dear DualCube Team,
    I would like to install your plugin "inactive user cleanup" on our moodle 3.5.+. Unfortunately ist is able until moodle 3.4.
    Do you know, for what period you can update your plugin?
    Best regards form Nürnberg
  • Picture of arvind gupta
    Thu, Feb 28, 2019, 8:25 PM
    Dear Simon,,
    Firstly, the changes in the path will not affect other things and secondly, if you make no change in the inactive user's setting and run the cron, it will not remove any user.
    It will remove the user if you set the specified date or time in inactive user's settings and if the user is inactive in that period.
    Lastly, the removed user will not be recovered as there is no option available in Moodle.

    Thank you.
  • Picture of tim st.clair
    Mon, Sep 2, 2019, 1:38 PM
    The version downloaded here doesn't seem to match the code on the Source Control URL (
    In this version, on Moodle 3.6.4 (Build: 20190513) PHP Version 7.0.33-0+deb9u3 during installaiton I get

    Fatal error: Namespace declaration statement has to be the very first statement in the script in [...snip] /admin/tool/inactive_user_cleanup/classes/task/tool_inactive_user_cleanup_task.php

    Easy enough to put the `namespace` ahead of the `defined` to fix it
  • Picture of avogadro vinci
    Mon, Oct 21, 2019, 7:38 PM
    I'm using the latest moodle 3.7.2 together with this plugin. I setup 365 days of inactivity with 14 days before the deletion. The majority of users are using oauth2 for office365 and the other the standard login. Today all the users have been deleted even active ones. How is possible?
    Thank you
  • Picture of DualCube Team
    Mon, Oct 21, 2019, 8:02 PM
    Inactive user clean-up plugin checks for the login log, in Moodle. When you have used oAuth for SSO login, Moodle did not get any login log. So the users are inactive still. This is the reason for such a phenomenon. Please restore the users by database restoration.

    Thank you.
  • Picture of Jean Clark
    Mon, Jan 13, 2020, 12:38 AM
    Okay, I am running Moodle 3.7 on PHP 7.3. Everything works beautifully except for this plugin. I've installed it many times in different ways but it keeps crashing, and this happens to be a very important plugin that I need to be able to use. I also cannot find an alternative.

    It crashes and it completely stops my Cron from working, at all. Once i uninstall it, the cron works properly again.
    Then I will reinstall it, I've tried zip file, and I've tried instlaling through the browser, and it crashes within a few hours everytime.

    the error it gives me is:
    /home/llumenam/ on line 28

    but line 28 is:
    namespace tool_inactive_user_cleanup\task;

    i don't understand what this means, it looks normal to me.
  • Picture of And Vie
    Wed, Mar 25, 2020, 5:00 AM
    Hi Jean Clark, the problem is probably already solved. I had the same problem. The plugin in its current version is programmed incorrectly. The abort leads to the fact that no more "planned processes" are recorded for the cronjobs. So the error has serious consequences. I finally deleted the plugin. But there is a workaround, which can be seen in the error message. You have to put the statement in the error line on top of the class (tool_inactive_user_cleanup_task.php). Namespaces have to be in the code first. I don't know if this is the only problem. Therefore I have deleted the plugin. Kind regards, Andreas
  • Picture of DualCube Team
    Wed, Mar 25, 2020, 2:02 PM
    Dear Jean,

    Please set up your SMTP properly from the outgoing mail configuration. Then test the outgoing mail configuration. After it is tested OK, please run the cron. It should solve the issue.

    Thank you.
1 2 3 4
Please login to post comments