From 7a5884cd74c2c1d1fa19bede7805ed8be9a2053d Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Sun, 7 Nov 2004 19:28:24 +0000
Subject: [PATCH] - Patch #11427: added 'edit own forum topics' permission.

---
 modules/forum.module       | 10 +++++++++-
 modules/forum/forum.module | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/forum.module b/modules/forum.module
index a3792ac51f10..147947f60f1d 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -44,16 +44,24 @@ function forum_node_name($node) {
  * Implementation of hook_access().
  */
 function forum_access($op, $node) {
+  global $user;
+
   if ($op == 'create') {
     return user_access('create forum topics');
   }
+
+  if ($op == 'update' || $op == 'delete') {
+    if (user_access('edit own forum topics') && ($user->uid == $node->uid)) {
+      return TRUE;
+    }
+  }
 }
 
 /**
  * Implementation of hook_perm().
  */
 function forum_perm() {
-  return array('create forum topics');
+  return array('create forum topics', 'edit own forum topics');
 }
 
 /**
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index a3792ac51f10..147947f60f1d 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -44,16 +44,24 @@ function forum_node_name($node) {
  * Implementation of hook_access().
  */
 function forum_access($op, $node) {
+  global $user;
+
   if ($op == 'create') {
     return user_access('create forum topics');
   }
+
+  if ($op == 'update' || $op == 'delete') {
+    if (user_access('edit own forum topics') && ($user->uid == $node->uid)) {
+      return TRUE;
+    }
+  }
 }
 
 /**
  * Implementation of hook_perm().
  */
 function forum_perm() {
-  return array('create forum topics');
+  return array('create forum topics', 'edit own forum topics');
 }
 
 /**
-- 
GitLab