Well I know that theres an option in Drupal 6 to have comment settings per content type. However I'm using Drupal 5 and have not been able to find anything related. The solution? Get Drupal 6... or create a simple but not to functional hack. My problem was that I needed to display the comments form at the bottom of the page for node type A, and while doing so I also needed to display the comment form on a new page for forums. This is what I came up with... Be warned I really suck with PHP, and also note that I have my settings to display comment form at the bottom of the page in order for this to work. So basically what I did was get my box.tpl and insert the following code:

if (arg(0) == 'node' && ctype_digit(arg(1))) {
$node = node_load(arg(1));
}
if ($node->type == 'article' || arg(0) == 'comment' && arg(1) == 'reply') {

print $title

print $content
}

Basically what I'm doing it only printing out the comment form for the content type of article and for urls with comment/reply
So with that done all you need to do is print out a link to comment/reply for any node types that are not node type A.

If anyone has a better way, and more flexible solution let me know as I have not been able to tackle this issue.

Comments

Gemma Morton’s picture

Why not use Panels2? http://drupal.org/Project/panels

It is in RC1 now. But, you can easily still display your nodes as you have them now, whilst displaying your Comment form with different options for each node type. Beyond all that, once you begin to learn about Panels and taste its wonderousness, youll find awesome things to do with it all over the place. No need to hack away at solutions you yourself arent too sure about.

walker2238’s picture

Thanks mckeen. I'll have a look into it but I believe my code if fine as is for my needs and don't see any problems with it. The reason I didn't inquire about panels was A - I didn't know about them. and B - I'm fairly new to PHP so would like to get my feet wet with making things harder on myself. Also I want to try to keep my database as small as possible so I tend to stay away from modules that create new database tables (ie... pathauto) at all costs. However no that I read your post more carefully I see the words "change comment form options" as in setting I assume... Well thanks for taking the time to inform me about the module in case I do need it in the future.

Much thanks, Walker

txg0_0’s picture

use function hook_comment.
please read http://api.drupal.org/api/function/hook_comment/5

You can code follow my example

function yourModuleName_comment($a1, $op) {
  if ($op == 'form') {
    $nid = $a1['nid']['#value'];
    $node = node_load($nid);
    if($node->type == "blog") {
       //add your form elements here
       $form['aa'] = array('#type' => *****************);

       //Don't forget to return $form
       return $form;
    }
  }
}

====================
http://aymoo.cn

====================
http://aymoo.cn

walker2238’s picture

Hey thanks txg_0 So you suggest I put that function into a mini module? I'm afraid I don't understand the concept as far as for my needs. All I'm trying to do is print different box.tpl files based on node type. Care to explain the function in more detail?

txg0_0’s picture

Sorry, I misunderstood your meaning. Maybe you can hack line 1058 in comment.module, These codes decide if comment form being displayed.

<?php
    // If enabled, show new comment form if it's not already being displayed.
    $reply = arg(0) == 'comment' && arg(1) == 'reply';
    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) && !$reply) {
      $output .= comment_form_box(array('nid' => $nid), t('Post new comment'));
    }
?>

====================
http://aymoo.cn

walker2238’s picture

Yeah, I also tried to do that. The problem with that is comment_form_location is stored in the database. So changing it just changed everything. My code that I currently posted above does seem to work so far. It's just a matter of hiding the form and creating a link to the form. I was just curious to see if there was a better method. With so many people using Drupal you'd imagine someone else had this problem and maybe used a better solution that doesn't involve a module. I try to keep the modules to a minimum as I don't want a million modules being used for such a simple task. I guess in theory I could create new database tables for each of my node types but like I said what I have so far seems to work.