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

Ensure that you can't create a group with the same name as any other. Fixes #1752.

Problem caused by checking the owner of the group too, but the constraint is on the group name column only. Fixed by validating that no other group with the same name exists.
parent fdef98aa
......@@ -74,7 +74,7 @@ function creategroup_validate(Pieform $form, $values) {
global $USER;
global $SESSION;
$cid = get_field('group', 'id', 'owner', $USER->get('id'), 'name', $values['name']);
$cid = get_field('group', 'id', 'name', $values['name']);
if ($cid) {
$form->set_error('name', get_string('groupalreadyexists'));
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