aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups/actions')
-rw-r--r--mod/groups/actions/discussion/reply/save.php35
-rw-r--r--mod/groups/actions/groups/membership/join.php4
2 files changed, 28 insertions, 11 deletions
diff --git a/mod/groups/actions/discussion/reply/save.php b/mod/groups/actions/discussion/reply/save.php
index 109938dbb..a1ed036b6 100644
--- a/mod/groups/actions/discussion/reply/save.php
+++ b/mod/groups/actions/discussion/reply/save.php
@@ -9,6 +9,7 @@ gatekeeper();
// Get input
$entity_guid = (int) get_input('entity_guid');
$text = get_input('group_topic_post');
+$annotation_id = (int) get_input('annotation_id');
// reply cannot be empty
if (empty($text)) {
@@ -30,16 +31,30 @@ if (!$group->canWriteToContainer($user)) {
forward(REFERER);
}
-
-// add the reply to the forum topic
-$reply_id = $topic->annotate('group_topic_post', $text, $topic->access_id, $user->guid);
-if ($reply_id == false) {
- system_message(elgg_echo('groupspost:failure'));
- forward(REFERER);
+// if editing a reply, make sure it's valid
+if ($annotation_id) {
+ $annotation = elgg_get_annotation_from_id($annotation_id);
+ if (!$annotation->canEdit()) {
+ register_error(elgg_echo('groups:notowner'));
+ forward(REFERER);
+ }
+
+ $annotation->value = $text;
+ if (!$annotation->save()) {
+ system_message(elgg_echo('groups:forumpost:error'));
+ forward(REFERER);
+ }
+ system_message(elgg_echo('groups:forumpost:edited'));
+} else {
+ // add the reply to the forum topic
+ $reply_id = $topic->annotate('group_topic_post', $text, $topic->access_id, $user->guid);
+ if ($reply_id == false) {
+ system_message(elgg_echo('groupspost:failure'));
+ forward(REFERER);
+ }
+
+ add_to_river('river/annotation/group_topic_post/reply', 'reply', $user->guid, $topic->guid, "", 0, $reply_id);
+ system_message(elgg_echo('groupspost:success'));
}
-add_to_river('river/annotation/group_topic_post/reply', 'reply', $user->guid, $topic->guid, "", 0, $reply_id);
-
-system_message(elgg_echo('groupspost:success'));
-
forward(REFERER);
diff --git a/mod/groups/actions/groups/membership/join.php b/mod/groups/actions/groups/membership/join.php
index 210e285a5..b4f4e280c 100644
--- a/mod/groups/actions/groups/membership/join.php
+++ b/mod/groups/actions/groups/membership/join.php
@@ -10,6 +10,8 @@
* @package ElggGroups
*/
+global $CONFIG;
+
$user_guid = get_input('user_guid', elgg_get_logged_in_user_guid());
$group_guid = get_input('group_guid');
@@ -45,7 +47,7 @@ if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) {
add_entity_relationship($user->guid, 'membership_request', $group->guid);
// Notify group owner
- $url = "{$CONFIG->url}mod/groups/membershipreq.php?group_guid={$group->guid}";
+ $url = "{$CONFIG->url}groups/requests/$group->guid";
$subject = elgg_echo('groups:request:subject', array(
$user->name,
$group->name,