Skip to content

Instantly share code, notes, and snippets.

@shrop
Created June 8, 2011 13:10
Show Gist options
  • Save shrop/1014387 to your computer and use it in GitHub Desktop.
Save shrop/1014387 to your computer and use it in GitHub Desktop.
Rule to archive campus events 6 hours after the start date/time
array (
'rules' =>
array (
'rules_archive_events_rule' =>
array (
'#type' => 'rule',
'#set' => 'rules_archive_events_rule_set',
'#label' => 'Change workflow state to archived',
'#active' => 1,
'#weight' => '0',
'#categories' =>
array (
0 => 'Archive events',
),
'#status' => 'custom',
'#conditions' =>
array (
),
'#actions' =>
array (
0 =>
array (
'#weight' => 0,
'#info' =>
array (
'label' => 'Change workflow state to archived',
'label callback' => false,
'module' => 'Workflow',
'arguments' =>
array (
'node' =>
array (
'label' => 'Content',
'type' => 'node',
),
),
'base' => 'rules_core_action_execute',
'action_name' => 'workflow_select_given_state_action',
'configurable' => true,
),
'#name' => 'rules_core_workflow_select_given_state_action',
'#settings' =>
array (
'target_sid' => '4',
'state_name' => 'Archived',
'force' => 1,
'workflow_comment' => 'Action set %title to %state.',
'#argument map' =>
array (
'node' => 'node',
),
),
'#type' => 'action',
),
),
'#version' => 6003,
),
'rules_archive_events_triggered_rule' =>
array (
'#type' => 'rule',
'#set' => 'event_workflow_state_changed',
'#label' => 'Archive events',
'#active' => 1,
'#weight' => '0',
'#categories' =>
array (
0 => 'Archive events',
),
'#status' => 'custom',
'#conditions' =>
array (
0 =>
array (
'#weight' => 0,
'#info' =>
array (
'label' => 'Check workflow transition from Review Submission to Confirmed Submission',
'arguments' =>
array (
'old_state' =>
array (
'type' => 'workflow_state',
'label' => 'Old workflow state',
),
'new_state' =>
array (
'type' => 'workflow_state',
'label' => 'New workflow state',
),
),
'module' => 'Workflow',
),
'#name' => 'workflow_check_transition',
'#settings' =>
array (
'from_state' =>
array (
2 => '2',
),
'to_state' =>
array (
3 => '3',
),
'#argument map' =>
array (
'old_state' => 'old_state',
'new_state' => 'new_state',
),
),
'#type' => 'condition',
),
),
'#actions' =>
array (
0 =>
array (
'#weight' => 0,
'#type' => 'action',
'#settings' =>
array (
'task_identifier' => '[node:nid]',
'task_date' => '[node:field_event_date_time-datetime] +6 hours',
'#argument map' =>
array (
'node' => 'node',
),
'#eval input' =>
array (
'token_rules_input_evaluator' =>
array (
'task_identifier' =>
array (
0 => 'node',
),
'task_date' =>
array (
0 => 'node',
),
),
),
),
'#name' => 'rules_action_schedule_set_rules_archive_events_rule_set',
'#info' =>
array (
'arguments' =>
array (
'task_identifier' =>
array (
'type' => 'string',
'label' => 'Identifier',
'description' => 'User provided string to identify the task. Existing tasks for this rule set with the same identifier will be replaced.',
),
'task_date' =>
array (
'type' => 'date',
'label' => 'Scheduled evaluation date',
),
'node' =>
array (
'label' => 'Event',
'type' => 'node',
),
),
'label' => 'Schedule "Archive events"',
'status' => 'custom',
'categories' =>
array (
0 => 'Archive events',
),
'module' => 'Rule Scheduler',
'base' => 'rules_scheduler_action',
'set' => 'rules_archive_events_rule_set',
),
),
),
'#version' => 6003,
),
),
'rule_sets' =>
array (
'rules_archive_events_rule_set' =>
array (
'arguments' =>
array (
'node' =>
array (
'label' => 'Event',
'type' => 'node',
),
),
'label' => 'Archive events',
'status' => 'custom',
'categories' =>
array (
0 => 'Archive events',
),
),
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment