Comment Closer

Drush command to close comments

There is a great module called Comment Closer that allows you to automatically close comments on certain nodes after a certain time period.

On a recent project, needed to come up with a solution to close comments apart from a cron job and without adding yet another module to the site.

I decided to make use of drush and created my first drush command.

With the drush file properly installed, I can now execute the following command from the site root directory:

drush comment-close --days=7 --types=story,blog

This command will close comments on all story and blog nodes that are older than 7 days.