aboutsummaryrefslogtreecommitdiff
path: root/mod/messages/actions/messages/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messages/actions/messages/delete.php')
-rw-r--r--mod/messages/actions/messages/delete.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/mod/messages/actions/messages/delete.php b/mod/messages/actions/messages/delete.php
new file mode 100644
index 000000000..ffdb3b3a3
--- /dev/null
+++ b/mod/messages/actions/messages/delete.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Delete message
+ */
+
+$guid = (int) get_input('guid');
+
+$message = get_entity($guid);
+if (!$message || !$message->canEdit()) {
+ register_error(elgg_echo('messages:error:delete:single'));
+ forward(REFERER);
+}
+
+if (!$message->delete()) {
+ register_error(elgg_echo('messages:error:delete:single'));
+} else {
+ system_message(elgg_echo('messages:success:delete:single'));
+}
+
+forward(REFERER);