delete.php 480 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * Delete comment entity
  4. *
  5. * @package Elgg.Core
  6. * @subpackage Comments
  7. */
  8. $comment_guid = get_input('guid');
  9. $comment = get_entity($comment_guid);
  10. if (elgg_instanceof($comment, 'object', 'comment') && $comment->canEdit()) {
  11. if ($comment->delete()) {
  12. system_message(elgg_echo('generic_comment:deleted'));
  13. } else {
  14. register_error(elgg_echo('generic_comment:notdeleted'));
  15. }
  16. } else {
  17. register_error(elgg_echo('generic_comment:notfound'));
  18. }
  19. forward(REFERER);