From b71a8f06f1670d0e2d3eeb4457e1ac06c25975a0 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 3 Apr 2008 17:10:42 +0000 Subject: Added comments to blog git-svn-id: https://code.elgg.org/elgg/trunk@396 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/actions/comments/add.php | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 mod/blog/actions/comments/add.php (limited to 'mod/blog/actions') diff --git a/mod/blog/actions/comments/add.php b/mod/blog/actions/comments/add.php new file mode 100644 index 000000000..8a54cde13 --- /dev/null +++ b/mod/blog/actions/comments/add.php @@ -0,0 +1,44 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + // Make sure we're logged in; forward to the front page if not + if (!isloggedin()) forward(); + + // Get input + $blogpost_guid = (int) get_input('blogpost_guid'); + $comment = get_input('comment'); + + // Let's see if we can get an entity with the specified GUID, and that it's a blog post + if ($blogpost = get_entity($blogpost_guid)) { + if ($blogpost->getSubtype() == "blog") { + + // If posting the comment was successful, say so + if ($blogpost->annotate('comment',$comment,$blogpost->access_id, $_SESSION['guid'])) { + + system_message(elgg_echo("comment:success")); + + } else { + system_message(elgg_echo("comment:failure")); + } + + } + + } else { + + system_message(elgg_echo("blog:notfound")); + + } + + // Forward to the + forward("mod/blog/read.php?blogpost=" . $blogpost_guid); + +?> \ No newline at end of file -- cgit v1.2.3