From 5a432ff2474e70caf88c19a8b413405d14e61d4d Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Fri, 18 May 2012 11:44:19 -0300 Subject: Fixes #4480: Forward to REFERER after comment delete --- actions/comments/delete.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'actions') diff --git a/actions/comments/delete.php b/actions/comments/delete.php index f8458a152..f2c058ff4 100644 --- a/actions/comments/delete.php +++ b/actions/comments/delete.php @@ -12,19 +12,12 @@ if (!elgg_is_logged_in()) { // Make sure we can get the comment in question $annotation_id = (int) get_input('annotation_id'); -if ($comment = elgg_get_annotation_from_id($annotation_id)) { - - $entity = get_entity($comment->entity_guid); - - if ($comment->canEdit()) { - $comment->delete(); - system_message(elgg_echo("generic_comment:deleted")); - forward($entity->getURL()); - } - +$comment = elgg_get_annotation_from_id($annotation_id); +if ($comment && $comment->canEdit()) { + $comment->delete(); + system_message(elgg_echo("generic_comment:deleted")); } else { - $url = ""; + register_error(elgg_echo("generic_comment:notdeleted")); } -register_error(elgg_echo("generic_comment:notdeleted")); forward(REFERER); \ No newline at end of file -- cgit v1.2.3