User Suspension

Admin tools ::: tool_usersuspension
Maintained by Sebsoft Plugins, Rogier van Dongen
The Sebsoft User Suspension Plugin offers you the possibility to automate the process of suspending users and/or removing user accounts (using moodle's default methods to delete users).
Latest release:
338 sites
39 fans
Current versions available: 4

The Sebsoft User Suspension Plugin offers you the possibility to automate the process of suspending users and/or removing user accounts (using moodle's default methods to delete users).

Suspending users is provided in three different ways:

  • Using a folder
  • Using a file upload
  • Manually through a status table

Deleting users is, if configured to be enabled, provided by comparing the date of suspending to the configured period before removal. Once the configured interval has past and the user is deemed suspended for the configured period, the useraccount will be removed using moodle's standard methods.

Furthermore, there's extensive settings that can be configured to turn every feature on or off, as well as disabling the whole tool's features.

This tool also provides a way of excluding users to be suspended or processed in case of automated processing. There are two methods provided at the moment: single user exclusion and cohort exclusion. During all three different ways of automated suspending / deleting users, only users that have NOT been configured to be excluded, either by cohort or by single user, will be processed.

Important note

Site administrators and the default guest account are completely left out of this tool. For safety measures, it is not recommended to put any form of automation on suspending or deleting administrator accounts or the default guest account, hence the decision to exclude them in any processing.


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6
Screenshot #7
Screenshot #8


Sebsoft Plugins (Lead maintainer)
Rogier van Dongen: Project leader
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Fri, Jan 10, 2020, 4:31 AM
    How do you change the email wording?
  • Logo Sebsoft
    Mon, Jan 13, 2020, 4:26 AM
    Hi António & Greg,
    To make changes to the mail the plugin sends out, please edit the language translation.
    When you open up your language pack, locate the file tool_usersuspention.php in the correct language. The relevant translations starts with 'email:user:'.

    Kind regards,
  • Mon, Apr 27, 2020, 5:09 AM
    This plugin does what it promises, it suspends users.

    However there is couple places where it's not working. First, I don't see any logs. When I go to "Logs" tab it gives me error message
    Exception - Argument 4 passed to table_sql::set_sql() must be of the type array, null given, called in [dirroot]/admin/tool/usersuspension/classes/logtable.php on line 124
    Another thing where this plugin fails is to order users by timedetect or by suspendin in the "Users to suspend" tab. I wonder if this is happening because I have over 500 users in that list, so this plugin cannot order that many users. However list can be ordered by name or username without any problem.
    I am using Moodle 3.8 and latest release of the plugin.
  • Mon, May 4, 2020, 6:12 PM
    Dear Asko,
    I've addressed the issues and changed the queries so that you should also be able to sort correctly.
    Please be aware another change was made so users "to be suspended/deleted" will also show for those that should have been suspended/deleted already (Many negative values would be an indication your cron might not run corrcetly).
    Cheers, R
  • Sat, May 9, 2020, 5:25 AM
    Hi everyone, what a nice plugin. I have two questions:

    1. I set the dir where the plugin will search the .csv file so it automatically supend the users inside that file, but nothing is happening. I set an interval of 5 min but is not working. Am I doing someting wrong?
    2. Is there an option to do the same thing, but in a reverse way using this plugin? Upload a .csv file and then un-suspend or activate the users inside that file?
    I am using Moodle 3.8
  • Tue, Jun 2, 2020, 5:39 AM
    Dear Rogier,
    Thank you for the update! Logs are now working as expected. However ordering users by "suspendin" is still not working. For some reason in this new update "suspendin" time is shown twice for every user, and when trying to order by that column, there is no change on the user order whatsoever. This must happen because I have 900 users on that section. If I try to order by similar "deletein" column where I have only 100 users, it works without any problems.
  • Thu, Jun 4, 2020, 5:44 PM
    @Asko: will be resolved in the new version.

    @Godfrey: one first thing that comes to mind is what the delimiter of your CSV file is. It should be a semi-colon (;), although I might choose to make this configurable in a future release.
    UN-suspending users from CSV is actually not a bad idea at all. Might also implement this in a next version.
  • Tue, Sep 1, 2020, 7:17 PM
    Hi, the source repository and bug tracker is no longer active: "Bitbucket no longer supports Mercurial repositories".
  • Tue, Sep 1, 2020, 7:35 PM
    Hi Martin,
    Thanks for the message and your correct (this is the case for all of our plugins at the moment). We've been in the process of migrating to gitlab/github, which was succesful.
    However, we don't have a decent pipeline to the public repositories on github yet.
    I'll have to ask about the status and will update to the correct repositories asap.
  • Tue, Dec 15, 2020, 10:06 PM
    New version is here!
    Version checked up to Moodle 3.10.
    Also, we've finally migrated to github. Sorry for the delays; this year has been busier than ever.
  • Tue, Apr 6, 2021, 8:41 PM
    Hi Rogier,
    I have moodle 3.9. I am testing this plugin but the automation to suspend/unsuspend users is not working via the automatic feature. My csv file is saved with ";" and I am using only the email information. I did a change in order to have this files checked every minute but nothing works. Any advice? Thank you. Andrea
  • Tue, Apr 6, 2021, 9:18 PM
    Hi @Andrea, can you pass me a message through either the messaging system on this site or through email (you can find the email address from basically any random file in the plugin sources)?
    I've seen your earlier question as well although it has disappeared from view (maybe you've removed it).
    It's somewhat easier to aid you personally through e.g. email, because I try to avoid long messages here.
    Cheers, Rogier
  • Fri, Apr 30, 2021, 8:59 PM
    Hi Rogier, I thought this plugin was the solution for my problem but it’s not. I want to suspend a user not by inactivity but pure on a period of time. My users pay per Year so I want to suspend then automatically one year after the user is created. Is that something you'll add to functionality of your plugin?
  • Mon, May 3, 2021, 5:14 PM
    Hello Jan,
    Could you message me in person through email (or optionally: message me through the repository issue tracker)?
    I have an idea how to facilitate this but it may just fall outside of scope of the plugin intention depending on optional other requirements you may have.
    Looking forward to seeing your response,
    Cheers, Rogier
  • Ricardo Caiado
    Mon, Oct 11, 2021, 10:39 AM

    Is "User Suspension 3.5.5 (build 2020121500)"compatible with Postgresql 12?

    When accessing "Users to suspend" tab I got this error message:


    Error reading from database

    Debug info: ERROR: function unix_timestamp() does not exist
    LINE 2: ...ccess, u.timemodified) AS timedetect,(31536000 - (UNIX_TIMES...
    HINT: No function matches the given name and argument types. You might need to add explicit type casts.
    SELECT,u.username, '' || u.firstname || ' ' || u.lastname AS name,u.lastlogin,u.firstaccess,u.lastaccess,u.timemodified,u.suspended,u.deleted,GREATEST(u.firstaccess, u.lastaccess, u.timemodified) AS timedetect,(31536000 - (UNIX_TIMESTAMP() - GREATEST(u.firstaccess, u.lastaccess, u.timemodified))) AS suspendin,NULL as action
    FROM mdl_user u
    WHERE (u.confirmed = 1 AND u.suspended = 0 AND u.deleted = 0 AND u.mnethostid = $1 AND ((u.lastaccess = 0 AND u.firstaccess > 0 AND u.firstaccess > $2) OR (u.lastaccess > 0 AND u.lastaccess > $3) OR (u.auth = 'manual' AND u.firstaccess = 0 AND u.lastaccess = 0 AND u.timemodified > 0 AND u.timemodified > $4)) AND NOT IN ($5,$6,$7)) OR (u.confirmed = 1 AND u.suspended = 0 AND u.deleted = 0 AND u.mnethostid = $8 AND ((u.lastaccess = 0 AND u.firstaccess > 0 AND u.firstaccess < $9) OR (u.lastaccess > 0 AND u.lastaccess < $10) OR (u.auth = 'manual' AND u.firstaccess = 0 AND u.lastaccess = 0 AND u.timemodified > 0 AND u.timemodified < $11)) AND NOT IN ($12,$13,$14))
    LIMIT 25
    [array (
    0 => '1',
    1 => 1602383800,
    2 => 1602383800,
    3 => 1602383800,
    4 => 1,
    5 => 2,
    6 => 3,
    7 => '1',
    8 => 1602383800,
    9 => 1602383800,
    10 => 1602383800,
    11 => 1,
    12 => 2,
    13 => 3,
    Error code: dmlreadexception
    Stack trace:

    line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 329 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
    line 920 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
    line 2017 of /lib/tablelib.php: call to pgsql_native_moodle_database->get_records_sql()
    line 2039 of /lib/tablelib.php: call to table_sql->query_db()
    line 231 of /admin/tool/usersuspension/classes/statustable.php: call to table_sql->out()
    line 158 of /admin/tool/usersuspension/classes/statustable.php: call to tool_usersuspension\statustable->render_to_suspend()
    line 88 of /admin/tool/usersuspension/view/statuslist.php: call to tool_usersuspension\statustable->render()
1 2
Please login to post comments