archive.php 662 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Elgg reported content: archive action
  4. *
  5. * @package ElggReportedContent
  6. */
  7. $guid = (int) get_input('guid');
  8. $report = get_entity($guid);
  9. if (!$report || $report->getSubtype() !== "reported_content" || !$report->canEdit()) {
  10. register_error(elgg_echo("reportedcontent:notarchived"));
  11. forward(REFERER);
  12. }
  13. // allow another plugin to override
  14. if (!elgg_trigger_plugin_hook('reportedcontent:archive', 'system', ['report' => $report], true)) {
  15. register_error(elgg_echo("reportedcontent:notarchived"));
  16. forward(REFERER);
  17. }
  18. // change the state
  19. $report->state = "archived";
  20. system_message(elgg_echo("reportedcontent:archived"));
  21. forward(REFERER);