Commit 200a3084 authored by Nigel McNie's avatar Nigel McNie
Browse files

Send the user to the group view page once they have created a group.

Do this by making group_create return the ID of the created group.
parent 021bed2b
...@@ -86,7 +86,7 @@ function creategroup_submit(Pieform $form, $values) { ...@@ -86,7 +86,7 @@ function creategroup_submit(Pieform $form, $values) {
list($grouptype, $jointype) = explode('.', $values['grouptype']); list($grouptype, $jointype) = explode('.', $values['grouptype']);
group_create(array( $id = group_create(array(
'name' => $values['name'], 'name' => $values['name'],
'description' => $values['description'], 'description' => $values['description'],
'grouptype' => $grouptype, 'grouptype' => $grouptype,
...@@ -98,7 +98,7 @@ function creategroup_submit(Pieform $form, $values) { ...@@ -98,7 +98,7 @@ function creategroup_submit(Pieform $form, $values) {
$SESSION->add_ok_msg(get_string('groupsaved', 'group')); $SESSION->add_ok_msg(get_string('groupsaved', 'group'));
redirect('/group/mygroups.php'); redirect('/group/view.php?id=' . $id);
} }
?> ?>
...@@ -196,6 +196,7 @@ function group_user_can_assess_submitted_views($groupid, $userid) { ...@@ -196,6 +196,7 @@ function group_user_can_assess_submitted_views($groupid, $userid) {
* userid => role, * userid => role,
* ... * ...
* ) * )
* @return int The ID of the created group
*/ */
function group_create($data) { function group_create($data) {
if (!is_array($data)) { if (!is_array($data)) {
...@@ -285,6 +286,8 @@ function group_create($data) { ...@@ -285,6 +286,8 @@ function group_create($data) {
} }
db_commit(); db_commit();
return $id;
} }
/** /**
......
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