aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/actions/blog/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/blog/actions/blog/delete.php')
-rw-r--r--mod/blog/actions/blog/delete.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/mod/blog/actions/blog/delete.php b/mod/blog/actions/blog/delete.php
new file mode 100644
index 000000000..ca4eb8a7f
--- /dev/null
+++ b/mod/blog/actions/blog/delete.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Delete blog entity
+ *
+ * @package Blog
+ */
+
+$blog_guid = get_input('guid');
+$blog = get_entity($blog_guid);
+
+if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) {
+ $container = get_entity($blog->container_guid);
+ if ($blog->delete()) {
+ system_message(elgg_echo('blog:message:deleted_post'));
+ if (elgg_instanceof($container, 'group')) {
+ forward("blog/group/$container->guid/all");
+ } else {
+ forward("blog/owner/$container->username");
+ }
+ } else {
+ register_error(elgg_echo('blog:error:cannot_delete_post'));
+ }
+} else {
+ register_error(elgg_echo('blog:error:post_not_found'));
+}
+
+forward(REFERER); \ No newline at end of file