diff options
Diffstat (limited to 'mod/reportedcontent/actions/reportedcontent/delete.php')
-rw-r--r-- | mod/reportedcontent/actions/reportedcontent/delete.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mod/reportedcontent/actions/reportedcontent/delete.php b/mod/reportedcontent/actions/reportedcontent/delete.php new file mode 100644 index 000000000..f7d4e2107 --- /dev/null +++ b/mod/reportedcontent/actions/reportedcontent/delete.php @@ -0,0 +1,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); +} |