123456789101112131415161718192021222324252627282930 |
- <?php
- /**
- * Delete topic action
- *
- */
- $topic_guid = (int) get_input('guid');
- $topic = get_entity($topic_guid);
- if (!elgg_instanceof($topic, 'object', '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");
|