From f6ff517215d63d55c47a212a7a3ee477d4def791 Mon Sep 17 00:00:00 2001 From: marcus Date: Thu, 3 Jul 2008 18:54:08 +0000 Subject: End of day commit of first (semi working) code. Working: - Join/leave on public groups - Create / edit groups Not working: - Private groups - the skin/display of the group - profile main page - widgets Refs #109 Closes #115 git-svn-id: https://code.elgg.org/elgg/trunk@1279 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/actions/edit.php | 60 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 mod/groups/actions/edit.php (limited to 'mod/groups/actions/edit.php') diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/edit.php new file mode 100644 index 000000000..4e9cdf99e --- /dev/null +++ b/mod/groups/actions/edit.php @@ -0,0 +1,60 @@ +group as $shortname => $valuetype) { + $input[$shortname] = get_input($shortname); + if ($valuetype == 'tags') + $input[$shortname] = string_to_tag_array($input[$shortname]); + } + + $user_guid = get_input('user_guid'); + $user = NULL; + if (!$user_guid) $user = $_SESSION['user']; + else + $user = get_entity($user_guid); + + $group_guid = get_input('group_guid'); + + $group = new ElggGroup($group_guid); // load if present, if not create a new group + if (($group_guid) && (!$group->canEdit())) + { + system_message(elgg_echo("groups:cantedit")); + + forward($_SERVER['HTTP_REFERER']); + exit; + } + + // Assume we can edit or this is a new group + if (sizeof($input) > 0) + { + foreach($input as $shortname => $value) { + $group->$shortname = $value; + } + } + + // Get access + $group->access_id = get_input('access_id', 0); + + $group->save(); + + $group->join($user); // Creator always a member + + system_message(elgg_echo("groups:saved")); + + // Forward to the user's profile + forward($group->getUrl()); + exit; +?> \ No newline at end of file -- cgit v1.2.3