delete.php 348 B

123456789101112131415161718
  1. <?php
  2. $guid = (int) get_input('guid');
  3. elgg_entity_gatekeeper($guid, 'object', ElggAnswer::SUBTYPE);
  4. $answer = get_entity($guid);
  5. if (!$answer->canEdit()) {
  6. register_error(elgg_echo('actionunauthorized'));
  7. forward(REFERER);
  8. }
  9. $question = $answer->getContainerEntity();
  10. $answer->delete();
  11. forward(get_input('forward', $question->getURL()));