Skip to content

Instantly share code, notes, and snippets.

@masiorama
Created July 4, 2013 14:32
Show Gist options
  • Save masiorama/5928284 to your computer and use it in GitHub Desktop.
Save masiorama/5928284 to your computer and use it in GitHub Desktop.
Drupal workflow rules example
/**
* DRUPAL
* Use of the rules
* Example of unpublishing a node on a date with rules scheduler
*/
Create the Rule set first...then the Rule.
at /admin/config/workflow/rules/components/add
Create a ruleset (name it "Unpublish Content")
In the Settings/Variables:
Data type = "Node"
Label = "node"
Machine name = "node"
Save
...next screen...
Add rule
Name = "Unpublish Content Rule"
Save
Conditions:
Content is published
Data selector = node
Save
Content is of type = node
Value = your-content type
Save
Actions:
Unpublish content
Data selector = node
Save
at /admin/config/workflow/rules
Create a rule (name it "Unpublish Rule"
React on event = After saving new content
Save
Conditions:
Content is of type
Data selector = node
Value = your-content-type
Save
Actions:
Schedule component evaluation
Component Value = Unpublish Content
Data selector = node:field-your-node-date-field
Identifier value = unpublish [node:nid]
node Data selector = node
Save
Run the cron
Configuration->system->cron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment