Skip to content

A Moodle CLI script to delete courses based on course id, category id, or user id.

Notifications You must be signed in to change notification settings

daparker26/moodle-cli-delete-courses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

About

This is a simple script for deleting single and mass Moodle courses through the CLI. You can delete courses by course id, category id, or a user id where the user is enrolled as an 'editingteacher' role.

Add this script to the admin/cli folder in your Moodle root directory.

Use

Delete single or multiple courses.

This script is helpful if you need to delete mass courses by category or by enrolled faculty, or if you want a convenient way to delete a course by ID.

If by category, you must enter the category id. The script will not delete courses in subcategories.

If by editingteacher, you must enter the user ID. This script will search for courses in which the user is enrolled as editingteacher. If there are multiple editingteacher users in a course, the course will not be deleted.

Options:
-h, --help | Print out this help
-c, --category | Deletes courses by category
-t, --teacher | Deletes courses by teacher
-id, --courseid | Deletes course by id
-f, --force | Force option. Won't prompt for individual courses when deleting by category or teacher.

Example:
$sudo -u www-data /usr/bin/php admin/cli/delete_courses.php

About

A Moodle CLI script to delete courses based on course id, category id, or user id.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages