Commit 7a5884cd authored by Dries's avatar Dries
Browse files

- Patch #11427: added 'edit own forum topics' permission.
parent a16be349
...@@ -44,16 +44,24 @@ function forum_node_name($node) { ...@@ -44,16 +44,24 @@ function forum_node_name($node) {
* Implementation of hook_access(). * Implementation of hook_access().
*/ */
function forum_access($op, $node) { function forum_access($op, $node) {
global $user;
if ($op == 'create') { if ($op == 'create') {
return user_access('create forum topics'); 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(). * Implementation of hook_perm().
*/ */
function forum_perm() { function forum_perm() {
return array('create forum topics'); return array('create forum topics', 'edit own forum topics');
} }
/** /**
......
...@@ -44,16 +44,24 @@ function forum_node_name($node) { ...@@ -44,16 +44,24 @@ function forum_node_name($node) {
* Implementation of hook_access(). * Implementation of hook_access().
*/ */
function forum_access($op, $node) { function forum_access($op, $node) {
global $user;
if ($op == 'create') { if ($op == 'create') {
return user_access('create forum topics'); 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(). * Implementation of hook_perm().
*/ */
function forum_perm() { function forum_perm() {
return array('create forum topics'); return array('create forum topics', 'edit own forum topics');
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment