By shadow_jh on
I've been looking for a way to accomplish this, but as of yet am unsuccessful. Is there a way to stop allowing certain content types from being published beyond a specific date and time? I was thinking maybe a cron job I could set up, but then I wasn't sure how to get around the login issue. Any thoughts?
Comments
If you have a custom module
If you have a custom module for your site a simple hook_form_alter with a condition that tests the node/add/contest_content_type against a date (which could be set through admin settings), you could stop new nodes being created and supply a message such as "Contest expired..."
Passing Phase Web Development
This sounds interesting...
This sounds interesting... unfortunately I don't have any experience creating drupal modules.
you could probably use the
you could probably use the rules module and schedule a rule to remove create permission from the content type at a specified time.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Because of the modules
Because of the modules needed to bring the site to its current status, drupal 5 was needed - rules is or 6. Even so, I didn't see an option for content types.
The rules module can
The rules module can definitely handle this-- you would create a custom rule with php that's run with the cron event. Unfortunately, the d5 version, which was called "workflow_ng", doesn't have the cron event iirc-- that leaves you with new zeal's suggestion.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Ok, I ended up using
Ok, I ended up using workflow_ng - which seems to be perfect. I created some custom php :
So if a user tries to add new content of that type, this code comes back true and the corresponding rule that I set up, redirects them to their other options with a message that says "sorry, this contest has ended".
Pretty cool stuff... I just wish there was a way to set up an interface for this functionality rather than having to dive into php.