diff --git sites/all/modules/forum_access/forum_access.module sites/all/modules/forum_access/forum_access.module index 19f6a17..a770bae 100644 --- sites/all/modules/forum_access/forum_access.module +++ sites/all/modules/forum_access/forum_access.module @@ -125,7 +125,11 @@ function forum_access_init() { if ($level = forum_access_access($tid, $a)) { module_load_include('node.inc', 'forum_access'); $user->_forum_access_moderator = $level; - if (arg(0) == 'comment' || arg(0) == 'node' && arg(2) == 'edit') { + if (version_compare(VERSION, '6.16', '>')) { + // globally enable comment moderator on node view - not only on node edits and comment paths + _forum_access_enable_moderator(); + } + else if (arg(0) == 'comment' || arg(0) == 'node' && arg(2) == 'edit') { _forum_access_enable_moderator(); } } @@ -320,13 +324,37 @@ if (!variable_get('forum_access_D5_legacy_mode', FALSE)) * * Remove the 'Add new comment' link from nodes, if the user does not have the * 'create' permission. + * From D6.16 on, alter comment links. */ -function forum_access_link_alter(&$links, $node) +function forum_access_link_alter(&$links, $node, $comment = NULL) { global $user; + if ($user->uid != 1 && ($tid = _forum_access_get_tid($node)) && isset($links['comment_add']) && !forum_access_access($tid, 'create')) { unset($links['comment_add']); } + + if (version_compare(VERSION, '6.16', '>')) { + $tid = $node->tid; + if (isset($links['comment_reply']) && (!forum_access_access($tid, 'create'))) { + unset($links['comment_reply']); + } + if (isset($links['comment_edit']) + && !forum_access_access($tid, 'update') + && !comment_access('edit', $comment)) { + unset($links['comment_edit']); + } + if (isset($links['comment_delete']) && !forum_access_access($tid, 'delete')) { + unset($links['comment_delete']); + } + + if (!isset($links['comment_reply'])) { + $links['comment_forbidden'] = array( + 'title' => theme('comment_post_forbidden', $variables['node']), + 'html' => TRUE, + ); + } + } } /** @@ -342,6 +370,7 @@ function forum_access_preprocess_box(&$variables) { } } +if (version_compare(VERSION, '6.16', '<=')) { /** * Implementation of $modulename_preprocess_$hook() for comment. * @@ -355,6 +384,8 @@ function forum_access_preprocess_comment(&$variables) { } } +} // End of VERSION <= 6.16 + } // End of !LEGACY-MODE /** diff --git sites/all/modules/forum_access/forum_access.node.inc sites/all/modules/forum_access/forum_access.node.inc index cf4cad5..950088e 100644 --- sites/all/modules/forum_access/forum_access.node.inc +++ sites/all/modules/forum_access/forum_access.node.inc @@ -203,6 +203,8 @@ function _forum_access_get_all_roles() { } /** + * Recreate comment links + * * Recreate comment links (they've already been themed), and * remove those that aren't accessible to the user. */