Index: comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.520.2.6 diff -u -F^f -r1.520.2.6 comment.module --- comment.module 26 Jul 2007 19:16:45 -0000 1.520.2.6 +++ comment.module 3 Oct 2007 06:22:36 -0000 @@ -341,7 +341,7 @@ function comment_link($type, $node = NUL if ($node->comment == COMMENT_NODE_READ_WRITE) { if (user_access('post comments')) { - if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { + if (comment_form_location($node) == COMMENT_FORM_SEPARATE_PAGE) { $links['comment_add'] = array( 'title' => t('Add new comment'), 'href' => "comment/reply/$node->nid", @@ -1056,7 +1056,7 @@ function comment_render($node, $cid = 0) } // If enabled, show new comment form. - if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW)) { + if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (comment_form_location($node) == COMMENT_FORM_BELOW)) { $output .= comment_form_box(array('nid' => $nid), t('Post new comment')); } @@ -1811,12 +1811,14 @@ function theme_comment_thread_expanded($ function theme_comment_post_forbidden($nid) { global $user; + $node = node_load($nid); + if ($user->uid) { return t("you can't post comments"); } else { // we cannot use drupal_get_destination() because these links sometimes appear on /node and taxo listing pages - if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { + if (comment_form_location($node) == COMMENT_FORM_SEPARATE_PAGE) { $destination = "destination=". drupal_urlencode("comment/reply/$nid#comment-form"); } else { @@ -2015,3 +2017,20 @@ function vancode2int($c = '00') { return base_convert(substr($c, 1), 36, 10); } +/** + * Determines the location of the comment form for the specified node. + * Fallback is global comment setting. + * + * @param $node + * The node the form is being displayed on. + * @return + * The location setting. + */ +function comment_form_location($node = NULL) { + if (isset($node->comment_form_location)) { + return $node->comment_form_location; + } + else { + return variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE); + } +}