From 608647dcf59c60e55d86a69e39e2626e6f1eb6bc Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 3 Mar 2011 01:41:18 +0000 Subject: Refs #2679 - returning to a separate annotation for discussion forum replies. For those using the latest out of svn you can update with this script: https://gist.github.com/852092 git-svn-id: http://code.elgg.org/elgg/trunk@8570 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/actions/discussion/reply/delete.php | 26 +++++++++++++++ mod/groups/actions/discussion/reply/save.php | 45 ++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 mod/groups/actions/discussion/reply/delete.php create mode 100644 mod/groups/actions/discussion/reply/save.php (limited to 'mod/groups/actions/discussion') diff --git a/mod/groups/actions/discussion/reply/delete.php b/mod/groups/actions/discussion/reply/delete.php new file mode 100644 index 000000000..88c6b79d6 --- /dev/null +++ b/mod/groups/actions/discussion/reply/delete.php @@ -0,0 +1,26 @@ +name != 'group_topic_post') { + register_error(elgg_echo('discussion:reply:error:notdeleted')); + forward(REFERER); +} + +if (!$reply->canEdit()) { + register_error(elgg_echo('discussion:error:permissions')); + forward(REFERER); +} + +$result = $reply->delete(); +if ($result) { + system_message(elgg_echo('discussion:reply:deleted')); +} else { + register_error(elgg_echo('discussion:reply:error:notdeleted')); +} + +forward(REFERER); diff --git a/mod/groups/actions/discussion/reply/save.php b/mod/groups/actions/discussion/reply/save.php new file mode 100644 index 000000000..e535856da --- /dev/null +++ b/mod/groups/actions/discussion/reply/save.php @@ -0,0 +1,45 @@ +getContainerEntity(); +if (!$group->isMember($user)) { + register_error(elgg_echo('groups:notmember')); + 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); +} + +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); -- cgit v1.2.3