blob: f307aa091998a8727ea9688d879f0a33cf41717b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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");
|