Guides · Courses in the VLE

Moodle recycle bin: restoring deleted activities and courses

The Pulse issues list showing open recording problems for a demo university.

A teacher deletes the wrong quiz. A manager deletes a course that was still in use. Moodle keeps both for a short time in a recycle bin, and there are two bins in two different places. This guide covers where each is, why the link goes missing, what comes back, and what to do after the retention time.

Menu names are from the Moodle 5.3 documentation. The setting names are from the recycle bin's own settings files in the Moodle 5.3 source code, because the documentation page does not list them.

Two recycle bins

Course recycle bin Category recycle bin
Holds Activities and resources deleted from a course, including those in a deleted section Deleted courses
Where it is In the course: Course navigation > More > Recycle bin, or the Administration block, depending on the theme Site administration > Courses > Manage courses and categories, then the Actions menu (cog icon) of the category the course was in > Recycle bin
Who, in the documentation's words Teachers Those with the relevant category permissions
Kept for, by default Seven days Seven days

To restore an activity, open the course recycle bin and choose the restore icon beside it. To restore a course, open the recycle bin of its old category and choose Restore. Teachers cannot delete courses, so a deleted course is a question for a manager or an administrator.

Why the recycle bin link is missing

Cause What to check
The bin is empty By default the link appears only when something is in the bin
Cron has not caught up The link appears "after a short while": cron has to run and the page be refreshed. Meanwhile Moodle shows "Activity deletion in progress..."
It was a course Deleted courses sit in the category's recycle bin, not inside any course
The recycle bin is switched off Site administration > Plugins > Admin tools
A backup setting is off Include activities and resources (backup_auto_activities), under Site administration > Courses > Backups > Automated backup setup, must be ticked
The time ran out Items are permanently deleted after seven days, or the time the administrator has set
The course is still being deleted From Moodle 5.3 a site can delete courses in the background. A course marked Queued for deletion cannot be restored until the deletion completes
Your role By default in the 5.3 source, non-editing teachers can view the bin, and teachers and managers can also restore from it

Moodle recommends running cron every minute, which activity deletion with the recycle bin requires. If the link never shows on any course, check cron at Site administration > Reports > System status.

Turning it on, and the settings

The documentation says the recycle bin "may be enabled or disabled in Site administration / Plugins / Admin tools". These are the settings there, with their defaults in Moodle 5.3:

Setting Default What it does
Enable course recycle bin On Keeps deleted activities and resources
Item lifetime 7 days How long a deleted item stays
Enable category recycle bin On Keeps deleted courses
Course lifetime 7 days How long a deleted course stays
Auto hide On Hides the link when the bin is empty

Turn Auto hide off and the link stays in place when the bin is empty.

What comes back

The recycle bin runs on Moodle's backup settings: the documentation says the automated backup settings are also used for it. When it is enabled, a course backup is made as a course is deleted, so the course can be restored later.

That matters for student work. User data in a deleted activity (the documentation lists assignment submissions, grades and published forum posts) can be restored from the bin only if two more settings are ticked:

  • backup_auto_users, on the Automated backup setup page
  • restore_general_users, on the General restore defaults page

If either is off, expect the activity back without the work students did in it. Check both before anyone needs them.

Emptying the recycle bin

Nothing needs emptying by hand: items go when their lifetime ends, and the bin shows a notice that its contents will be permanently deleted after that time. To clear it sooner, delete single items or use Delete all, which asks "Are you sure you want to delete all items from the recycle bin?". Treat either as final.

After the retention time has passed

Once an item has left the bin, the way back is a backup.

  1. Look for a course backup. Course navigation > More > Course reuse > Restore lists the files in the course backup area and in your own private backup area.
  2. Ask your administrator whether the site keeps automated course backups. Restoring from those needs the capability "Restore courses from automated backups".
  3. Restore the backup as a new course, so the live course is left as it is.
  4. Bring the lost activity across with Course reuse > Import, which lets you choose the elements to include. Import does not include any user data, so grades and submissions have to be read in the restored copy.
  5. If the restore sits on pending, see our guide to a Moodle course restore stuck on pending.

Clearing out last year's students is a different job with its own rules: see resetting a Moodle course.

A worked example

At a demo university a teacher deletes the Week 4 quiz at 16:10 on a Tuesday, then realises it was the live one, with 38 attempts.

  • At 16:11 there is no Recycle bin link under More.
  • At 16:13, after a refresh, the link is there. The restore icon puts the quiz back in the course.
  • The attempts are not in it. The administrator finds backup_auto_users unticked, so the bin held no user data.
  • A course backup with user data, taken on Monday, is in the course backup area. Restored as a new course, it shows the grades up to Monday. Tuesday's attempts have to be sat again.

The site ticks both user data settings that week, and turns Auto hide off.

Check the course after a restore

A course restored from the category bin or an older backup is the course as it stood that day. Give it the checks a rolled-over course gets.

Six checks for a rolled-over Moodle course, from dates to recording links

Bradawl Content Check works with Moodle. It opens a course backup made without user data, runs in your browser and sends nothing anywhere, and lists what a rollover left behind, as the Moodle rollover checklist describes. It has been tested on invented data, and no findings is not a sign-off that a course is ready. Download Content Check, or see all the free tools.

Moodle is a trademark of its owner. Bradawl is independent and not affiliated with it.

Related guides

Panopto, Blackboard, Moodle, Canvas and Microsoft Teams are trademarks of their owners. Bradawl is independent and not affiliated with them.