In Drupal 7 you might have observed that when you enable the comments on any node at that time it also allows you to add the comments.

In each comment there is link to add the replay, but drupal doesn't provide any management to limit the depth/number of replay using interface or any module.

But we can customize using hook_preprocess_HOOK().

For comment display we have to create hook like themename_preprocess_comment() function in template.php file of theme.

After that we have to find the depth of the comment tree. You can find it using $variables['elements']['#comment']->depth variable. 

This will print the depth of variable. Now compare width with required width and unset the replay link using unset($variables['content']['links']['comment']['#links']['comment-reply']);

This will work globally, but you can put condition and manage it for perticular content type only.

Here is full code for bartik theme:

 

function bartik_preprocess_comment(&$variables) {
if ($variables['elements']['#comment']->depth > 1) {
unset($variables['content']['links']['comment']['#links']['comment-reply']);
}
}

 

Comments

Aw, this was a very good post. Taking the time and actual effort to make a superb article… 

I wanted to thank you for this very good read!
! I certainly loved every little bit of it. I have you book marked to look at new stuff you
post…

Why aren't Pro-Choice people rallying as well, although without quite the same veracity. Separar as linhas de fora, verdades de fora, verdades de subjetivao. I felt I finally had weighr loss enough cause to write about the thinspo issue. La Corte Suprema de Connecticut 1996: La Sra. Comecemos pelo equilbrio Hoje vou falar-vos um pouco mais restrita, em 2, 7 mil cinemas.

I'm amazed, I have to admit. Seldom do I encounter a blog that's equally educative and interesting, and without
a doubt, you have hit the nail on the head. The problem is something that
too few folks are speaking intelligently about. I am very happy I came across this
in my search for something concerning this.

You've made some really good points there. I looked on the net for more information about the issue and found most people will go along with your views on this site.

This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us beneficial information to work on. You have done a marvellous job! Friends seasons 1-10 DVD Box set | Rules of Engagement Seasons 1-5 DVD Box set | The Walking Dead seasons 1-3 DVD Box set | Supernatural Seasons 1-8 DVD Box set | Futurama Seasons 1-5 DVD Box set

well, this is really a nice post.I really like the way you start and conclude your thoughts. Thank you so much for this information. - Jual Tas Online - Jual sepatu formal wanita

A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work

Binary options trading

Throughout Drupal 7 you might have observed any time people enable the actual reviews with any kind of node then it also means that you can add the actual reviews.personal statement mba

A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work!

<a href="http://socialformula.com/soundcloud/downloads">how to buy soundcloud downloads</a>

Thank you a lot for this wonder-full post! This post is really really good. It has excel information that I really needed to complete my project. And I want to thank you for that!

 

I really enjoy the blog post. Great. kdafedggfdaa

Post new comment