blob: 313e87199c6c23092ebfcaa3d49f3f1da2dc7914 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
/**
* Elgg Groups: delete topic action
*
* @package ElggGroups
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider <info@elgg.com>
* @copyright Curverider Ltd 2008-2010
* @link http://elgg.org/
*/
$group_entity = get_entity(get_input('group'));
// Get input data
$topic_guid = (int) get_input('topic');
$group_guid = (int) get_input('group');
$topic = get_entity($topic_guid);
if ($topic->getSubtype() == "groupforumtopic") {
// Make sure we actually have permission to edit
if (!$topic->canEdit()) {
register_error(elgg_echo("groupstopic:notdeleted"));
forward(REFERER);
}
// Delete it!
$rowsaffected = $topic->delete();
if ($rowsaffected > 0) {
// Success message
system_message(elgg_echo("groupstopic:deleted"));
} else {
register_error(elgg_echo("groupstopic:notdeleted"));
}
// Forward to the group forum page
$url = $CONFIG->wwwroot . "pg/groups/forum/{$group_guid}/";
forward($url);
}
?>
|