Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like an to have my Drupal forum set up so that an administrator can disable comments (by selecting disable comments in forum topic) for a particular topic, but then 24 hours later have comments opened up again automatically.

Can anyone help?

share|improve this question

Your friend here is hook_cron().

Furthermore, you would need to check how to find the nodes that have had comments switched off in the last 24 hours. There's something useful you can check (perhaps it is the node's change time), or you have to keep a record yourself by implementing hook_nodeapi().

share|improve this answer

You could you use the Rules module, and set up a rule that re-enables comments after x amount of time.

  • Install Rules
  • Create a new rule
  • When you get to midnight (or whenever), then enable comments on posts that have comments disabled.

There's not really much more I can say. The Rules module is really self explanatory when you create a new one.

The only issue you may have is whether or not Rules has the option of enabling comments. If it doesn't, then you're looking at creating a custom module that hooks into Cron.

share|improve this answer
enabling comments is not in option list :( – Zaid Nov 29 '11 at 11:56
Sorry then, that won't work :-p you're looking at creating a custom module that implements a Cron job then! Can't really help with that now I'm afraid :( – Chapabu Nov 29 '11 at 12:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.