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

Make sure users are made members of groups they create. Also make sure admins...

Make sure users are made members of groups they create. Also make sure admins are tutors in said groups, if they're controlled.
parent dbd01854
......@@ -108,7 +108,7 @@ function creategroup_submit(Pieform $form, $values) {
);
// If the user is a staff member, they should be added as a tutor automatically
if ($values['membershiptype'] == 'controlled' && $USER->get('staff')) {
if ($values['membershiptype'] == 'controlled' && ($USER->get('staff') && $USER->get('admin'))) {
log_debug('Adding staff user to group');
insert_record(
'group_member',
......@@ -120,6 +120,17 @@ function creategroup_submit(Pieform $form, $values) {
)
);
}
else {
insert_record(
'group_member',
(object) array(
'group' => $id,
'member' => $USER->get('id'),
'ctime' => $now,
'tutor' => 0
)
);
}
$SESSION->add_ok_msg(get_string('groupsaved'));
......
Markdown is supported
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