Deleting old users

Re: Deleting old users

by Moodle Admin -
Number of replies: 1

If you do not need the data delete with a cron job from also database

You can also anonymize user data if you want to use for statistical purpose.

In reply to Moodle Admin

Re: Deleting old users

by Zoran Jančić -
Picture of Particularly helpful Moodlers

OK, how exactly to delete users from the database? I'm desperately  trying to find a way to do that. Deleting user's record from the mdl_user DB table is not an option because it would break relations with other tables. 

Is there any easy way to anonymize old deleted users without having to do it manually in the database by executing a DB query?