aboutsummaryrefslogtreecommitdiff
path: root/mod/reportedcontent/actions/reportedcontent/delete.php
blob: f7d4e210767371702b8a7df81d5ee1deae10c185 (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
<?php
/**
 * Elgg reported content: delete action
 * 
 * @package ElggReportedContent
 */

$guid = (int) get_input('guid');

$report = get_entity($guid);

// Make sure we actually have permission to delete
if ($report->getSubtype() == "reported_content" && $report->canEdit()) {

	// give another plugin a chance to override
	if (!elgg_trigger_plugin_hook('reportedcontent:delete', 'system', array('report' => $report), TRUE)) {
		register_error(elgg_echo("reportedcontent:notdeleted"));
		forward(REFERER);
	}

	if ($report->delete()) {
		system_message(elgg_echo("reportedcontent:deleted"));
	} else {
		register_error(elgg_echo("reportedcontent:notdeleted"));
	}
	
	forward(REFERER);
}