Here is a small howto that will show you how to unpublish a node after a given time can be in days, in seconds … Drupal using the module Rules
First, what does the module Rules?
Rules can be viewed as an evolution of the core module and trigger is the enhanced version of drupal 6 work flowing to Drupal 5.
Rules allow to discover events, perform actions (post a comment, send an email …) automatically with the possibility of moving conditions.
Here is a small howto to un-publish content after a certain time, it could be 15 days, 30 seconds, Wednesday, Nov 09 …
First, you must install the Rules.
1. Creating Rule Sets: Go to / admin / rules / rule_sets
- Click on “Add a new rule set”.
- Add a title, eg “Unpublish content {} rule set” with the name and machine-readable “unpublish_content.”
- In the Arguments, select “Content” as data type, enter “Content {argument}” as a title and “unpublish_content_content” as the machine readable name.
- Then save your form.
- You will be redirected to the overview of the rules sets and you can see the rule set that you just created.
- Then click on it and add a new rule by clicking the “Add new rule”
- Add a title such as “Unpublish {action} rule” and click Save.
- You will then be on a page for editing the rule click on “Add an action.”
- You will have a selection list, you should choose “Node | Remove the contents of the publication” (NOT “Rule Set | Publish content”!) And confirm by clicking Next.
- You have nothing to do normally in the form on which you have been directed, except change the title to “Unpublish content {action}” to more easily track and then save.
- Go to the page admin / rules / rule_sets and click on your rule (rule Unpublish content {set})
- Then click on the action (action {rule} Unpublish) to edit
- Add Action and select “Schedule Unpublish content»
- Choose the identifier [unpublish_content_content: nest] if you follow the terms I used, otherwise fit machine readable name given in the above arguments.
- Set the date of execution, for example 2011-12-12 10:33:55 or “one day”, you can refer to the PHP formats strtotime ()
2. Creation of or triggers (trigger): Go to / admin / rules / trigger
- Click on “Add a New Rule”
- Choose to label “Unpublish content triggered rule {}”
- Select “Node | After saving new content” and save
- Add Action
- Select “Rule Scheduler | Schedule rule Unpublish content {set}”
- Add Condition “Node | Content is published ‘
- You can also add a requirement for a given content type, why add a new condition
- And select “Node | Content Type as” and choose your or your content types.
Well, your rule is created and will be executed each time when the cron run. I hope this tutorial has helped you a little.
Well, that is my first check out to blog.bodhost.com ! We are a group of volunteers and starting a brand new initiative in a regional community in the exact same niche. Your blog supplied us valuable information to work on. You have done a marvelous task!