How To Remove a "Reply" Link In Drupal 7 Comments

In your template.php file add the following code:

function themename_preprocess_comment(&$variables) {
  unset($variables['content']['links']['comment']['#links']['comment-reply']);
}

Don't forget to change themename to your theme's name. Now, everything should be working.

Comments

Submitted by Alex on Thu, 08/30/2012 - 23:02

That'll work but the more elegant approach would be to use hide() instead of unset() so that it's still in the render array and just flagged so its not shown. http://api.drupal.org/api/drupal/includes!common.inc/function/hide/7

Submitted by Tim on Fri, 08/31/2012 - 17:39

hide() won't work there, unfortunatelly.

Submitted by Vasi on Thu, 08/30/2012 - 23:34

Yes, that's pretty much the only solution to this issue... Maybe a more flexible solution would be to use a separate permission for this.

Submitted by Mike Skull on Wed, 09/05/2012 - 11:42

Ive used this in the past to help manage it using the admin area on a content type basis: (so as to avoid a push to live to change it for a new content type added for instance)

http://drupal.org/project/flatcomments

Thought it might help

Add new comment

You are here