Commit f705276e authored by Nigel McNie's avatar Nigel McNie
Browse files

When a group is made into a controlled group, make the owner into a tutor.

Before this wasn't happening, so if an administrator created a group, then later edited it and turned it into a controlled group, the group would have no tutors.
parent 8da020d9
......@@ -120,6 +120,19 @@ function editgroup_submit(Pieform $form, $values) {
'id'
);
// Ensure the user is marked a tutor of the group if necessary
if ($values['membershiptype'] == 'controlled' && $USER->can_create_controlled_groups()) {
update_record(
'group_member',
(object) array(
'group' => $values['id'],
'member' => $USER->get('id'),
'tutor' => 1
),
array('group', 'member')
);
}
$SESSION->add_ok_msg(get_string('groupsaved', 'group'));
db_commit();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment