aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions/forums
diff options
context:
space:
mode:
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-22 13:23:27 +0000
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-22 13:23:27 +0000
commit7ccee82ef0284fb0399369ad6282cd9ddc3e0e1d (patch)
treecd6120b422f554f52e1febf7406f5a226019b49d /mod/groups/actions/forums
parenta6e8eb522323fa2e3f2c1fd6e58a3eec9857db63 (diff)
downloadelgg-7ccee82ef0284fb0399369ad6282cd9ddc3e0e1d.tar.gz
elgg-7ccee82ef0284fb0399369ad6282cd9ddc3e0e1d.tar.bz2
users can now edit and delete their forum comments
git-svn-id: https://code.elgg.org/elgg/trunk@2877 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/actions/forums')
-rw-r--r--mod/groups/actions/forums/deletepost.php4
-rw-r--r--mod/groups/actions/forums/editpost.php52
2 files changed, 54 insertions, 2 deletions
diff --git a/mod/groups/actions/forums/deletepost.php b/mod/groups/actions/forums/deletepost.php
index 2298a930a..9c89610bb 100644
--- a/mod/groups/actions/forums/deletepost.php
+++ b/mod/groups/actions/forums/deletepost.php
@@ -21,8 +21,8 @@
if ($post = get_annotation($post_id)) {
- //check that the user can edit
- if ($post->canEdit()) {
+ //check that the user can edit as well as admin
+ if ($post->canEdit() || ($post->owner_guid == $_SESSION['user']->guid)) {
//delete
$post->delete();
diff --git a/mod/groups/actions/forums/editpost.php b/mod/groups/actions/forums/editpost.php
new file mode 100644
index 000000000..bd37c5c31
--- /dev/null
+++ b/mod/groups/actions/forums/editpost.php
@@ -0,0 +1,52 @@
+<?php
+
+ /**
+ * Elgg groups plugin edit post action.
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ */
+
+ // Make sure we're logged in (send us to the front page if not)
+ if (!isloggedin()) forward();
+
+ // Check the user is a group member
+ $group_guid = get_input('group');
+ $group_entity = get_entity($group_guid);
+ if (!$group_entity->isMember($vars['user'])) forward();
+
+ //get the required variables
+ $post = get_input("post");
+ $post_comment = get_input("postComment");
+ $annotation = get_annotation($post);
+ $commentOwner = get_input("commentOwner");
+ $access_id = get_input("access_id");
+ $topic = get_input("topic");
+
+ if($annotation){
+
+ //can edit? Either the comment owner or admin can
+ if($annotation->canedit() || ($commentOwner == $_SESSION['user']->guid)){
+
+ update_annotation($post, "group_topic_post", $post_comment, "",$commentOwner, $access_id);
+ system_message(elgg_echo("groups:forumpost:edited"));
+
+ }else{
+ system_message(elgg_echo("groups:forumpost:error"));
+ }
+
+ }else{
+
+ system_message(elgg_echo("groups:forumpost:error"));
+ }
+
+ // Forward to the group forum page
+ global $CONFIG;
+ $url = $CONFIG->wwwroot . "mod/groups/topicposts.php?topic={$topic}&group_guid={$group_guid}/";
+ forward($url);
+
+
+?> \ No newline at end of file