Drupal - Remove subject field from comments

You can turn it off in the UI at admin/structure/types/manage/type-name with the "Allow comment title" checkbox:

enter image description here


There I have found some solutions to this question.

Option 1:

How to disable comment titles in Drupal 7. This is so easy and good tutorial to simply hide the subject(title) of comment through user interface.

Option 2:

You can also use the hook_preprocess_comment() in template.php file of your current active theme. This is really cool snippet, you can also some other options ie. comment-reply, comment-delete or comment-edit etc.

function bartik_preprocess_comment(&$vars) {
  $vars['submitted'] = $vars['created'] . ' — ' . $vars['author'];
  switch( $vars['node']->type ){
    case 'macine-name-of-node-type':
      $vars['title'] =FALSE;
    break;
  }
}

Tags:

Forms

Comments

7