aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions/discussion/reply/save.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-03 01:41:18 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-03 01:41:18 +0000
commit608647dcf59c60e55d86a69e39e2626e6f1eb6bc (patch)
tree0902b73d513ac13a3a57d69c73d7d55477d7471b /mod/groups/actions/discussion/reply/save.php
parent8f484535ba505b12d2d4ccdaf30686c375035108 (diff)
downloadelgg-608647dcf59c60e55d86a69e39e2626e6f1eb6bc.tar.gz
elgg-608647dcf59c60e55d86a69e39e2626e6f1eb6bc.tar.bz2
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
Diffstat (limited to 'mod/groups/actions/discussion/reply/save.php')
-rw-r--r--mod/groups/actions/discussion/reply/save.php45
1 files changed, 45 insertions, 0 deletions
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 @@
+<?php
+/**
+ * Post a reply to discussion topic
+ *
+ */
+
+gatekeeper();
+
+// Get input
+$entity_guid = (int) get_input('entity_guid');
+$text = get_input('group_topic_post');
+
+// reply cannot be empty
+if (empty($text)) {
+ register_error(elgg_echo('grouppost:nopost'));
+ forward(REFERER);
+}
+
+$topic = get_entity($entity_guid);
+if (!$topic) {
+ register_error(elgg_echo('grouppost:nopost'));
+ forward(REFERER);
+}
+
+$user = get_loggedin_user();
+
+$group = $topic->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);