The rules module it's not working with Content translation core module. When the rule module is triggered you lose the relationship between the different nodes that define a content translation.

How to reproduce:

1. Enable rules, locale and Content translation.
2. Enable two or more languages in (.../admin/settings/language)
2. Create a rule that change any story node from unpublished to published
3. Create a story node with unpublished state.

--> OK! The node is created and rules is triggered and the state changed.

4. Open your new node and translate to another language (...node/XXX/translate)

--> Fail! The node is created and published but it's created as a new node, not as a translation of the first node! The new node has lost the translation_source.

All node translations have a tnid in the {node} table and rules module lost the tnid when change or create a node.

Comments

fago’s picture

Component: Rules Core » Rules Engine
Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Oh, that sounds bad, however I don't think rules is really the problem here - is it does nothing more than using the provided API for saving the node. So I wonder, does this also happen when you manually publish the node? Which event are you using for publishing it?

matteoraggi’s picture

I'm publishing roles here on registration page, and I'm using the module user_selectable_roles
http://www.forniture-alberghiere.net/en/user/register

rapsli’s picture

Version: 6.x-1.0 » 6.x-1.2

experiencing this same problem... I'm having a look at it

rapsli’s picture

Oky. Here is my testrule that doesn't work with content translation. Steps.

- create page in language
- add translation
- rules is triggered
- node (the translated version) is being published -> updates the node table and overrides the tnid.

array (
  'rules' => 
  array (
    'rules_1' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_insert',
      '#label' => 'Tst',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#type' => 'action',
          '#settings' => 
          array (
            'message' => '... Es wurde ein neuer Node gespeichert.',
            'error' => 0,
          ),
          '#name' => 'rules_action_drupal_message',
          '#info' => 
          array (
            'label' => 'Show a configurable message on the site',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'message',
            ),
          ),
          '#weight' => 0,
        ),
        1 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Publish created content',
            'module' => 'Node',
            'arguments' => 
            array (
              'node' => 
              array (
                'label' => 'Content',
                'type' => 'node',
              ),
            ),
            'base' => 'rules_core_action_execute',
            'action_name' => 'node_publish_action',
            'configurable' => false,
            'label callback' => 'rules_core_node_label_callback',
            'label_skeleton' => 'Publish @node',
          ),
          '#name' => 'rules_core_node_publish_action',
          '#settings' => 
          array (
            'auto_save' => 1,
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#type' => 'action',
        ),
      ),
      '#version' => 6003,
    ),
  ),
)
fago’s picture

What rules does with the node is just issuing a programmatic "node_save()". This shouldn't pose any troubles though. But maybe try the event before content is saved and see whether it works that way.

rapsli’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

seems to be a Drupal core bug:

translation.module, translation_nodeapi()

$tnid is not being added to the node object. When later on rules is doing some stuff to the node object and saving the nodeobject the tnid is set to null and overwrites the the tnid again that was set by the translation module.

Put this into drupal core
#858136: tnid not being added to the node object