Change Amount of 'Recent Comments' in Drupal

  Share

I was setting up the new 'Recent Comments' block on the front page today. It was initially showing 10 comments, the default Drupal amount, but this was too much it was just cluttering. So I found a way to change the default number, it's a bit messy but it works. Here's how to do it:

Open the comment.module file, located in the modules folder in your drupal home directory. In your text editor around line 300 you will see a line that reads

function comment_get_recent($number = 10)

Change the 10 to whatever number of comments you want to show, I used 5 so mine looks like

function comment_get_recent($number = 5),

Save the file, and now 5 comments will show instead of the default 10.

 

Note: This is a messy option, as hard coding a change always is, if you update your drupal code, you will lose the change.


Comments

<a

<a href=http://freezfile.com>Good</a> job thanks for the info I'll try this if i found some new then I'll share with you
Thanks dear....

I have to try this out soon.

I have to try this out soon. This seems to be a very amazing idea. If this works for me, I'll let you know. Thanks for sharing.

Good idea, I will try on my

Good idea, I will try on my website too, I notice some other websites have all the comments on the front page, such as more than 50. Is there a top limit for it?

I'm not sure of a limit, I

I'm not sure of a limit, I wouldn't see how there would be.

Good job thanks for the info

Good job thanks for the info I'll try this if i found some new then I'll share with you
Thanks dear........

I heard this will be a

I heard this will be a feature in Drupal 7? Is this true?

I heard this too, I saw some

I heard this too, I saw some development talk on Drupals site, http://drupal.org about it too. It will be handy to be able to change it without messing with code.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
Sorry, Have to ask! Register to stop seeing this!