aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/actions/comments/delete.php
blob: 8eee2c96176cb3b75a2eb5c33069edd979840f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

	/**
	 * Elgg blog: delete comment action
	 * 
	 * @package ElggBlog
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Ben Werdmuller <ben@curverider.co.uk>
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.org/
	 */

	// Ensure we're logged in
		if (!isloggedin()) forward();
		
	// Make sure we can get the comment in question
		$comment_id = (int) get_input('comment_id');
		if ($comment = get_annotation($comment_id)) {
			
			$url = "mod/blog/read.php?blogpost=" . $comment->entity_guid;
			if ($comment->canEdit()) {
				$comment->delete();
				system_message(elgg_echo("comment:deleted"));
				forward($url);
			}
			
		} else {
			$url = "";
		}
		
		system_message(elgg_echo("comment:notdeleted"));
		forward($url);

?>