? 530292_no_comments_access_denied_3.patch
? 530292_no_comments_access_denied_4.patch
Index: talk.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/talk/talk.module,v
retrieving revision 1.6.2.13
diff -u -p -r1.6.2.13 talk.module
--- talk.module	18 Aug 2009 15:15:41 -0000	1.6.2.13
+++ talk.module	18 Aug 2009 15:36:48 -0000
@@ -46,7 +46,17 @@ function talk_menu() {
  * Helper item for talk_menu: access callback.
  */
 function _talk_access($node) {
-  return ($node->nid && _talk_node_comment_value($node) && talk_activated($node->type) && user_access('access comments') && node_access('view', $node) && (variable_get('talk_page_no_comments', TRUE) || $node->comment_count));
+  // First, do the normal access checks.
+  $original_access = ($node->nid && _talk_node_comment_value($node) && talk_activated($node->type) && user_access('access comments') && node_access('view', $node) && (variable_get('talk_page_no_comments', TRUE) || $node->comment_count));
+  // Next, determine whether or not we are on a talk page.
+  $arg = arg(2);
+  if (!empty($arg) && $arg == 'talk') {
+    return $original_access;
+  }
+  else {
+    // If we aren't on a talk page, does the admin want the tab?
+    return $original_access && variable_get('talk_tab_on_other_tabs', TRUE);
+  }
 }
 
 /**
@@ -77,6 +87,11 @@ function talk_admin_form() {
     '#title' => t('Display a "talk" page if there are no comments?'),
     '#default_value' => variable_get('talk_page_no_comments', TRUE),
   );
+  $form['talk_tab_on_other_tabs'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show the "talk" tab when viewing pages other than the "talk" page'),
+    '#default_value' => variable_get('talk_tab_on_other_tabs', TRUE),
+  );
 
   return system_settings_form($form);
 }
