aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/actions/forums/deletepost.php44
-rw-r--r--mod/groups/start.php3
-rw-r--r--mod/groups/views/default/forum/topicposts.php2
-rw-r--r--mod/groups/views/default/groups/forum_latest.php2
4 files changed, 48 insertions, 3 deletions
diff --git a/mod/groups/actions/forums/deletepost.php b/mod/groups/actions/forums/deletepost.php
new file mode 100644
index 000000000..d84525b13
--- /dev/null
+++ b/mod/groups/actions/forums/deletepost.php
@@ -0,0 +1,44 @@
+<?php
+
+ /**
+ * Elgg Groups: delete topic comment action
+ *
+ * @package ElggGroups
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider <info@elgg.com>
+ * @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
+ $post_id = (int) get_input('post');
+ $group_guid = (int) get_input('group');
+ $topic_guid = (int) get_input('topic');
+
+ if ($post = get_annotation($post_id)) {
+
+ //check that the user can edit
+ if ($post->canEdit()) {
+
+ //delete
+ $post->delete();
+ //display confirmation message
+ system_message(elgg_echo("grouppost:deleted"));
+
+ }
+
+ } else {
+ $url = "";
+ system_message(elgg_echo("grouppost:notdeleted"));
+ }
+
+ // Forward to the group forum page
+ global $CONFIG;
+ $url = $CONFIG->wwwroot . "mod/groups/topicposts.php?topic={$topic_guid}&group_guid={$group_guid}";
+ forward($url);
+
+?> \ No newline at end of file
diff --git a/mod/groups/start.php b/mod/groups/start.php
index e97a3f2de..3ab30cb6f 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -332,5 +332,6 @@
register_action("groups/deletetopic",false,$CONFIG->pluginspath . "groups/actions/forums/deletetopic.php",true);
register_action("groups/addpost",false,$CONFIG->pluginspath . "groups/actions/forums/addpost.php",true);
register_action("groups/edittopic",false,$CONFIG->pluginspath . "groups/actions/forums/edittopic.php",true);
-
+ register_action("groups/deletepost",false,$CONFIG->pluginspath . "groups/actions/forums/deletepost.php",true);
+
?> \ No newline at end of file
diff --git a/mod/groups/views/default/forum/topicposts.php b/mod/groups/views/default/forum/topicposts.php
index 53c45a6d0..f1f840136 100644
--- a/mod/groups/views/default/forum/topicposts.php
+++ b/mod/groups/views/default/forum/topicposts.php
@@ -50,7 +50,7 @@
<?php
echo elgg_view("output/confirmlink",array(
- 'href' => $vars['url'] . "action/groups/forums/deletetopic?topic=" . $vars['entity']->entity_guid . "&group=" . (int)get_input('group_guid'),
+ 'href' => $vars['url'] . "action/groups/deletepost?post=" . $vars['entity']->id . "&topic=" . get_input('topic') . "&group=" . get_input('group_guid'),
'text' => elgg_echo('delete'),
'confirm' => elgg_echo('deleteconfirm'),
));
diff --git a/mod/groups/views/default/groups/forum_latest.php b/mod/groups/views/default/groups/forum_latest.php
index 360550cfd..3cf253afe 100644
--- a/mod/groups/views/default/groups/forum_latest.php
+++ b/mod/groups/views/default/groups/forum_latest.php
@@ -1,4 +1,4 @@
-<h2>Forum latest</h2>
+<h2><?php echo elgg_echo('groups:latestdiscussion'); ?></h2>
<?php
$forum = get_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 0, $vars['entity']->guid, 4, 0, "asc", false);