delete.php 373 B

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