Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.