diff options
Diffstat (limited to 'mod/groups/actions/discussion/delete.php')
-rw-r--r-- | mod/groups/actions/discussion/delete.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mod/groups/actions/discussion/delete.php b/mod/groups/actions/discussion/delete.php new file mode 100644 index 000000000..f307aa091 --- /dev/null +++ b/mod/groups/actions/discussion/delete.php @@ -0,0 +1,29 @@ +<?php +/** + * Delete topic action + * + */ + +$topic_guid = (int) get_input('guid'); + +$topic = get_entity($topic_guid); +if (!$topic || !$topic->getSubtype() == "groupforumtopic") { + register_error(elgg_echo('discussion:error:notdeleted')); + forward(REFERER); +} + +if (!$topic->canEdit()) { + register_error(elgg_echo('discussion:error:permissions')); + forward(REFERER); +} + +$container = $topic->getContainerEntity(); + +$result = $topic->delete(); +if ($result) { + system_message(elgg_echo('discussion:topic:deleted')); +} else { + register_error(elgg_echo('discussion:error:notdeleted')); +} + +forward("discussion/owner/$container->guid"); |