Deleting all quiz attempts of 50 users in 5 courses

Deleting all quiz attempts of 50 users in 5 courses

by Ahmad Amer -
Number of replies: 1

Salam Alykom


I have 50 accounts accounts that I share with a large number of users. These accounts are generic and can be used by anyone. I have 5 courses and these accounts give access to these 5 courses. So some users find that some quizzes have been attempted and solved by others.


I need to delete all quiz attempts for all these 50 generic ccounts every 24 hours either manually or automatically.


Is it possible?

Average of ratings: -
In reply to Ahmad Amer

Re: Deleting all quiz attempts of 50 users in 5 courses

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

If you don't mind trashing every other student interaction on the course you can probably do it via course reset, 

https://docs.moodle.org/38/en/Reset_course

or you may be able to do a custom reset via moosh in a script run from cron as follows.

https://moosh-online.com/commands/

"Reset course by ID. With -s or --settings option you can provide any supported setting for the restore. The value for -s option is a string with each setting in format key=value separated by space. This means you'll need to quote this string with double or single quotes when running the command. unenrol_users setting requires an array as a value - put at least one comma character (,) as a value to make moosh convert that into an array. Example:"

Average of ratings: Useful (2)