Change Amount of ‘Recent Comments’ in Drupal – Elf Knows It [ARCHIVED]

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.

You may also like...