aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions/discussion/reply/delete.php
blob: 88c6b79d631407d181d147e8f280e158ce777930 (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
<?php
/**
 * Delete discussion reply
 */

$id = (int) get_input('annotation_id');

$reply = elgg_get_annotation_from_id($id);
if (!$reply || $reply->name != 'group_topic_post') {
	register_error(elgg_echo('discussion:reply:error:notdeleted'));
	forward(REFERER);
}

if (!$reply->canEdit()) {
	register_error(elgg_echo('discussion:error:permissions'));
	forward(REFERER);
}

$result = $reply->delete();
if ($result) {
	system_message(elgg_echo('discussion:reply:deleted'));
} else {
	register_error(elgg_echo('discussion:reply:error:notdeleted'));
}

forward(REFERER);