I've set up a rule that unpublishes a book page after a certain amount of time and then sends an e-mail to the page author when it is unpublished.

That seems to work fine, but i'm having troubles getting it to work using Tokens in the e-mail. By using tokens in the e-mail (eg. "Your content [node:title] needs updating") the cron job fails (timeout).

No coding experience what so ever, but here's the code for the rule - maybe you can determine what's wrong from that.

Thanks.

array (
  'rules' => 
  array (
    'rules_unpublish' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_update',
      '#label' => 'unpublish',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          '#type' => 'condition',
          '#settings' => 
          array (
            'type' => 
            array (
              'book' => 'book',
            ),
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#name' => 'rules_condition_content_is_type',
          '#info' => 
          array (
            'label' => 'Updated content is Book page',
            'arguments' => 
            array (
              'node' => 
              array (
                'type' => 'node',
                'label' => 'Content',
              ),
            ),
            'module' => 'Node',
          ),
          '#weight' => 0,
        ),
        1 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Updated content is published',
            'arguments' => 
            array (
              'node' => 
              array (
                'type' => 'node',
                'label' => 'Content',
              ),
            ),
            'module' => 'Node',
          ),
          '#name' => 'rules_condition_content_is_published',
          '#settings' => 
          array (
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#type' => 'condition',
        ),
      ),
      '#actions' => 
      array (
      ),
      '#version' => 6003,
    ),
    'rules_unpublishshit' => 
    array (
      '#type' => 'rule',
      '#set' => 'rules_unpublish_rule_set',
      '#label' => 'unpublishshit',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#type' => 'action',
          '#settings' => 
          array (
            'auto_save' => 1,
            '#argument map' => 
            array (
              'node' => 'unpublish_node',
            ),
          ),
          '#name' => 'rules_core_node_unpublish_action',
          '#info' => 
          array (
            'label' => 'Unpublish Unpublish Node',
            'module' => 'Node',
            'arguments' => 
            array (
              'node' => 
              array (
                'label' => 'Content',
                'type' => 'node',
              ),
            ),
            'base' => 'rules_core_action_execute',
            'action_name' => 'node_unpublish_action',
            'configurable' => false,
            'label callback' => 'rules_core_node_label_callback',
            'label_skeleton' => 'Unpublish @node',
          ),
          '#weight' => 0,
        ),
        1 => 
        array (
          '#weight' => 0,
          '#type' => 'action',
          '#settings' => 
          array (
            'to' => 'urkopardo@gmail.com',
            'from' => '',
            'subject' => 'Hejsa',
            'message' => '[unpublish_node:book]',
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'message' => 
                array (
                  0 => 'unpublish_node',
                ),
              ),
            ),
          ),
          '#name' => 'rules_action_mail',
          '#info' => 
          array (
            'label' => 'Send a mail to an arbitrary mail address',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'subject',
              1 => 'message',
              2 => 'from',
              3 => 'to',
            ),
          ),
        ),
      ),
      '#version' => 6003,
    ),
  ),
  'rule_sets' => 
  array (
    'rules_unpublish_rule_set' => 
    array (
      'arguments' => 
      array (
        'unpublish_node' => 
        array (
          'label' => 'Unpublish Node',
          'type' => 'node',
        ),
      ),
      'label' => 'Unpublish action',
      'status' => 'custom',
      'categories' => 
      array (
      ),
    ),
  ),
)

Comments

Dave Reid’s picture

Component: Miscellaneous » Rules integration