aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions/discussion/reply/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups/actions/discussion/reply/delete.php')
-rw-r--r--mod/groups/actions/discussion/reply/delete.php26
1 files changed, 26 insertions, 0 deletions
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 @@
+<?php
+/**
+ * Delete discussion reply
+ */
+
+$id = (int) get_input('annotation_id');
+
+$reply = elgg_get_annotation_from_id($id);
+if (!$reply || $reply->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);