so, I was trying to get rid of the comment title and there is a lot to read about that on the net, but I still had my issues getting it right, so I came up with this, but I believe there should be a better way. What is the best way of doing this:

function theme_preprocess_comment(&$vars) {
// Remove the comment title
  $vars['title'] = NULL;

You can set your content type to not use comment title by unchecking "Allow comment title" under the settings for your content type.

disable comment title

Then I would copy comment.tpl.php to your theme and customize the output there instead of just unsetting the title value in theme_preprocess_comment().

| improve this answer | |

If you really want to do this by custom coding. Then create a custom Module. The following code will do this.

function your_modulename_form_comment_form_alter(&$form, &$form_state, &$form_id) { //This disables title field.

$form['subject']['#access'] = FALSE; return $form;


Hope this helps you.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.