aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/groups/actions/forums/editpost.php2
-rw-r--r--mod/groups/start.php20
-rw-r--r--mod/groups/views/default/forum/topicposts.php4
3 files changed, 23 insertions, 3 deletions
diff --git a/mod/groups/actions/forums/editpost.php b/mod/groups/actions/forums/editpost.php
index e3b5566ef..7f6e75683 100644
--- a/mod/groups/actions/forums/editpost.php
+++ b/mod/groups/actions/forums/editpost.php
@@ -29,7 +29,7 @@
if($annotation){
//can edit? Either the comment owner or admin can
- if($annotation->canedit() || ($commentOwner == $_SESSION['user']->guid)){
+ if(groups_can_edit_discussion($annotation, page_owner_entity()->owner_guid)){
update_annotation($post, "group_topic_post", $post_comment, "",$commentOwner, $access_id);
system_message(elgg_echo("groups:forumpost:edited"));
diff --git a/mod/groups/start.php b/mod/groups/start.php
index da6001d32..1b3cc2e1e 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -467,6 +467,26 @@
}
}
+ /**
+ * A simple function to see who can edit a group discussion post
+ * @param the comment $entity
+ * @param user who owns the group $group_owner
+ * @return boolean
+ */
+ function groups_can_edit_discussion($entity, $group_owner)
+ {
+
+ //logged in user
+ $user = $_SESSION['user']->guid;
+
+ if (($entity->owner_guid == $user) || $group_owner == $user || isadminloggedin()) {
+ return true;
+ }else{
+ return false;
+ }
+
+ }
+
// Register a handler for create groups
register_elgg_event_handler('create', 'group', 'groups_create_event_listener');
diff --git a/mod/groups/views/default/forum/topicposts.php b/mod/groups/views/default/forum/topicposts.php
index dd86c6679..5b259d13f 100644
--- a/mod/groups/views/default/forum/topicposts.php
+++ b/mod/groups/views/default/forum/topicposts.php
@@ -48,8 +48,8 @@
</table>
<?php
- //if the comment owner is looking at it, or admin they can edit
- if ($vars['entity']->canEdit() || ($vars['entity']->owner_guid == $_SESSION['user']->guid)) {
+ //if the comment owner is looking at it, or admin, or group owner they can edit
+ if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
?>
<p class="topic-post-menu">
<?php