mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-66156 block_myoverview: purge course favourites on course deletion.
This commit is contained in:
parent
1c3efe48f8
commit
2ab6f8a87e
@ -127,3 +127,14 @@ function block_myoverview_user_preferences() {
|
||||
|
||||
return $preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-delete course hook to cleanup any records with references to the deleted course.
|
||||
*
|
||||
* @param stdClass $course The deleted course
|
||||
*/
|
||||
function block_myoverview_pre_course_delete(\stdClass $course) {
|
||||
// Removing any starred courses which have been created for users, for this course.
|
||||
$service = \core_favourites\service_factory::get_service_for_component('core_course');
|
||||
$service->delete_favourites_by_type_and_item('courses', $course->id);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user