aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/actions/annotations/page/delete.php
blob: 792b7c0bc79716162b045c787d297f1245819a0f (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
<?php
/**
 * Remove a page (revision) annotation
 *
 * @package ElggPages
 */

// Ensure we're logged in
if (!elgg_is_logged_in()) {
	forward();
}

// Make sure we can get the annotations and entity in question
$annotation_id = (int) get_input('annotation_id');
$annotation = elgg_get_annotation_from_id($annotation_id);
$entity = get_entity($annotation->entity_guid);

if ($annotation && $entity->canEdit() && $annotation->canEdit()) {
	$annotation->delete();
	system_message(elgg_echo("pages:revision:delete:success"));
} else {
	register_error(elgg_echo("pages:revision:delete:failure"));
}

forward("pages/history/{$annotation->entity_guid}");