Moodle plugins directory: User Suspension | Moodle.org
User Suspension
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.
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
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.
@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.
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.
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.
Cheers!
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
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
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
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.id,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 u.id 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 u.id 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()
Too bad you didn't really check the main repository for updates because this bug was long fixed already (i can't always keep up with rolling out every change here).
Anyway: new version is available, please refer to changelog.
Cheers.
I would have to validate, but to my best recollection, the mandate for Moodle3.5 onwards is there on purpose because the code makes use of some core functionality that only exists from Moodle3.5 onwards (which is why the majority of our plugins only support Moodle 3.5 and up).
If you're really in need of this plugin and can't upgrade your Moodle, I advise you to contact me personally (see email address in the sources) to see if we can find a way to support your need.
Cheers
I noticed, after a reload of the Verions page, that there is a Build 3.3.0 for Moodle 3.4. So, I will try that first.
Is new functionality added since 3.4 -> 3.5 or is code just rewritten to make use of (newly added) core functions ?
Regards.
The main functionality in pre 3.5 versions is basically very similar, but there have been substantial additions (which may not really be that important) and a number of fixes. Some of those are specific to changes in the Moodle core in 3.5 onwards, but overall the main plugin functionality doesn't differ all that much.
For a decent overview, you could download the most recent version and then view the changelog in the archive. That should give you a basic idea of the changes. The majority of them are rather small fixes.
Having said that: I strongly do advise to first check the plugin outside of a production environment to make sure no users would accidentally be removed or suspended (suspending is no problem, but the plugin does support full removal of users which is an irreversible process!)
Of course you're always free to ask questions ;)
Cheers, Rogier