mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-64568 core_group: delete conversation and members on group deletion
This commit is contained in:
parent
978f233b8b
commit
7e0c4bde11
@ -548,12 +548,20 @@ function groups_delete_group($grouporid) {
|
||||
}
|
||||
}
|
||||
|
||||
$context = context_course::instance($group->courseid);
|
||||
|
||||
// delete group calendar events
|
||||
$DB->delete_records('event', array('groupid'=>$groupid));
|
||||
//first delete usage in groupings_groups
|
||||
$DB->delete_records('groupings_groups', array('groupid'=>$groupid));
|
||||
//delete members
|
||||
$DB->delete_records('groups_members', array('groupid'=>$groupid));
|
||||
|
||||
// Delete any members in a conversation related to this group.
|
||||
if ($conversation = \core_message\api::get_conversation_by_area('core_group', 'groups', $groupid, $context->id)) {
|
||||
\core_message\api::delete_all_conversation_data($conversation->id);
|
||||
}
|
||||
|
||||
//group itself last
|
||||
$DB->delete_records('groups', array('id'=>$groupid));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user