Skip to content
Snippets Groups Projects
Commit 028366d9 authored by Elmar Ludwig's avatar Elmar Ludwig Committed by David Siegfried
Browse files

delete course related datafield entries when the user leaves a course, fixes #559

parent 7533f825
No related branches found
No related tags found
No related merge requests found
...@@ -561,6 +561,9 @@ class MyCoursesController extends AuthenticatedController ...@@ -561,6 +561,9 @@ class MyCoursesController extends AuthenticatedController
// enable others to do something after the user has been deleted // enable others to do something after the user has been deleted
NotificationCenter::postNotification('UserDidLeaveCourse', $course_id, $GLOBALS['user']->id); NotificationCenter::postNotification('UserDidLeaveCourse', $course_id, $GLOBALS['user']->id);
// Delete course related datafield entries
DatafieldEntryModel::deleteBySQL('range_id = ? AND sec_range_id = ?', [$GLOBALS['user']->id, $course_id]);
// Delete from statusgroups // Delete from statusgroups
foreach (Statusgruppen::findBySeminar_id($course_id) as $group) { foreach (Statusgruppen::findBySeminar_id($course_id) as $group) {
$group->removeUser($GLOBALS['user']->id, true); $group->removeUser($GLOBALS['user']->id, true);
......
...@@ -2048,6 +2048,9 @@ class Seminar ...@@ -2048,6 +2048,9 @@ class Seminar
} }
} }
// Delete course related datafield entries
DatafieldEntryModel::deleteBySQL('range_id = ? AND sec_range_id = ?', [$user_id, $this->id]);
// Remove from associated status groups // Remove from associated status groups
foreach (Statusgruppen::findBySeminar_id($this->id) as $group) { foreach (Statusgruppen::findBySeminar_id($this->id) as $group) {
$group->removeUser($user_id, true); $group->removeUser($user_id, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment