Rules to send mail when translated content has changed

Events happening in the community are now at Drupal community events on www.drupal.org.
phoenix's picture

I would like to send an email when content in one of my site's languages changes. The mails has to go to the editors of the other languages, so they can update their version. I installed the rules module, but can't find an out of date event. How can I quickly add i18n events?

Thanks !

Comments

Combine with VBO

itangalo's picture

You could do what you're looking for with Views Bulk Operations.
I just wrote some guidance for a somewhat trickier task: http://groups.drupal.org/node/52828#comment-146098

Best of luck,
//Johan Falk, NodeOne, Sweden

Thanks

phoenix's picture

I'll give it a try, I also found your blog post today where you describe combining rules with vbo. (http://nodeone.se/drupal-planet/make-rules-dance-with-views-bulk-operations)

I've had a very poor crack at

apemantus's picture

I've had a very poor crack at it using Rules and VBO.

So far it works as:

  1. Node edited and saved (and translation marked as out of date)
  2. Saving the node makes Rules trigger a VBO with the nid of the saved node
  3. The VBO lists nodes that have a translation marked as out of date
  4. An email is sent as an action in VBO

The issues I have so far are:
- step 2, every time the node is saved, if the translation is still flagged as out of date it will resend the email (minor issue).
- step 4, I can't work out in VBO how to send an email to a role (major issue). Presumably I need to create a new action? I know that in Rules you can email a role, but under this workflow (as far as I am aware) I have to use VBO to handle the emailing.

One way would be to rewrite the view so rather than listing nodes, it lists users who have the translator role, but I can't work out how to tie that into the nid of the saved node: it should only contact them if the saved node that has been marked as out of date. Unfortunately, in views it's the translated nodes that are marked as out of date - there's nothing to show the original has been flagged.

(I'd also like to only list users whose language/domain is affected by the out of date translation - i.e. if the original is English and it's been translated into French, the German translator shouldn't receive an email.)

Ugh. I've had another go at

apemantus's picture

Ugh.

I've had another go at it and so far I'm here:

  1. On saving, Rules triggers a VBO sending it the nid
  2. The VBO view uses relationships (and distinct) to currently show a single row for that node if it has child translations that are marked out of date.
  3. If it has, the VBO then executes a Rule Set(!) that sends an email to all members of the translator role

This seems unsatisfactory to me as it seems weird to go Rules -> VBO -> Rules but I can't work out in VBO how to send to members of a role and I can't work out in Rules how to test whether on saving the "mark as out of date" box is ticked.

My ideal solution would send an email to the translators with a link to their version of the page (and it's title in their lanaguage). It would also be in either HTML email OR some way that turns node/17 (for example) into the path alias.

Completed

apemantus's picture

OK; turns out I was making it significantly more complicated than it needed to be.

Create a new rule when pages are updated
Create a new condition that executes custom PHP code. Use

<?php
if ($node->translation['retranslate']==1) { return true; } else {return false;}
?>

as the condition.

Add an action to send an email to all members of a role ("translators") and you have a set-up that works OK.

It doesn't give the path to the translated page or anything, but if that became significant, I guess I'd have to use something like VBO or custom code.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: