Hello I need to create a rule that every time you update a node send a mail by mail to all registered users on that node.
I tried inserting the condition of the rule on update node but I can not find any reference to load the node registration and therefore its author and his email.
Do you have any solutions?

Comments

lucavox created an issue. See original summary.

lucavox’s picture

Priority: Critical » Normal
Status: Active » Needs work

Solved!!!
with this rules, but now for every author node registration send 2 email!! ;-(

{ "rules_estasia_invio_mail_sblocco_viaggio_senza_acconto" : {
    "LABEL" : "ESTASIA - Invio Mail Sblocco Viaggio SENZA ACCONTO",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "php", "rules_i18n", "mimemail" ],
    "ON" : { "node_update--eventi" : { "bundle" : "eventi" } },
    "IF" : [
      { "AND" : [
          { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "eventi" : "eventi" } } } },
          { "data_is" : { "data" : [ "node:field-eventi-richiesta-acconto" ], "value" : "0" } },
          { "data_is" : { "data" : [ "node:field-viaggio-bloccato" ], "value" : "0" } }
        ]
      }
    ],
    "DO" : [
      { "entity_query" : {
          "USING" : {
            "type" : "node_registration",
            "property" : "node",
            "value" : [ "node" ]
          },
          "PROVIDE" : { "entity_fetched" : { "load_node_registration_id" : "Entit\u00e0 caricata" } }
        }
      },
      { "LOOP" : {
          "USING" : { "list" : [ "load-node-registration-id" ] },
          "ITEM" : { "list_item" : "Elemento attuale dell\u0027elenco" },
          "DO" : [
            { "mimemail" : {
                "USING" : {
                  "key" : [ "list-item:email" ],
                  "to" : [ "list-item:email" ],
                  "subject" : "Aggiornamento Prenotazione \u003Cstrong\u003E\u003C?php print $node-\u003Etitle; ?\u003E\u003C\/strong\u003E",
                  "body" : "\u003C?php \r\nglobal $base_url;\r\n$nodo = node_load($node-\u003Enid);\r\n\/\/$path = drupal_realpath($nodo-\u003Efield_eventi_foto_evento[\u0027und\u0027][0][\u0027uri\u0027]);\r\n$path = file_create_url($nodo-\u003Efield_eventi_foto_evento[\u0027und\u0027][0][\u0027uri\u0027]);\r\n$user = user_load($list_item-\u003Euid);\r\n$start = $node-\u003Efield__eventi_data[\u0027und\u0027][0][\u0027value\u0027];\r\n$start = date(\u0022d-m-y\u0022, strtotime($start));\r\n$desc = $node-\u003Efield_eventi_descrizione[\u0027und\u0027][0][\u0027value\u0027];\r\n$descrizione = substr($desc, 0, 200) . \u0027...\u0027;\r\n$alias = drupal_get_path_alias(\u0027node\/\u0027.$node-\u003Enid);\r\n\r\n?\u003E\r\n\u003Ctable style=\u0022background-color: #eeeeee; width: 700px; margin-left: auto; margin-right: auto;\u0022 cellpadding=\u00225px\u0022\u003E\r\n\u003Ctbody\u003E\r\n\u003Ctr style=\u0022height: 153px;\u0022\u003E\r\n\u003Ctd style=\u0022text-align: center; height: 153px; width: 100%;\u0022\u003E\u003Cimg style=\u0022align-text: center;\u0022 src=\u0022\u003C?php print $base_url.\u0027\/sites\/all\/themes\/theme925\/logo.png\u0027; ?\u003E\u0022 alt=\u0022estasiatravel.com\u0022 width=\u0022407\u0022 height=\u0022150\u0022 \/\u003E\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003Ctr style=\u0022height: 33px;\u0022\u003E\r\n\u003Ctd style=\u0022text-align: center; height: 33px; width: 100%;\u0022 valign=\u0022center\u0022\u003E\r\n\u003Cp\u003E\u003Cem\u003E[site:slogan]\u003C\/em\u003E\u003C\/p\u003E\r\n\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003Ctr style=\u0022height: 73px;\u0022\u003E\r\n\u003Ctd style=\u0022text-align: center; height: 73px; width: 100%;\u0022\u003E\r\n\u003Ctable style=\u0022width: 80%; background-color: white; margin-left: auto; margin-right: auto;\u0022\u003E\r\n\u003Ctbody\u003E\r\n\u003Ctr\u003E\r\n\u003Ctd\u003E\r\n\u003Ch2\u003EViaggio Confermato\u003C\/h2\u003E\r\n\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003Ctr\u003E\r\n\u003Ctd\u003E\r\n\u003Ch1\u003E\u003Cstrong\u003E \u003C?php print $node-\u003Etitle; ?\u003E\u003C\/strong\u003E\u003C\/h1\u003E\r\n\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003Ctr\u003E\r\n\u003Ctd\u003E\u003Ca href=\u0022\u003C?php print $alias; ?\u003E\u0022\u003E\u003Cimg style=\u0022display: block; margin: 0; border: 0; background: #eeeeee;\u0022 src=\u0022\u003C?php print $path; ?\u003E\u0022 alt=\u0022More\u0022 width=\u0022540\u0022 height=\u0022220\u0022 \/\u003E\u003C\/a\u003E\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003Ctr\u003E\r\n\u003Ctd\u003E\r\n\u003Ch4\u003E\r\n Ciao \u003C?php print $user-\u003Ename; ?\u003E,\u003Cbr\u003E\r\n\t\t\t   Ti informiamo che il viaggio e\u0027 stato confermato!! \u003Cbr\u003E\r\n\t\t\t  ----- La data di Partenza \u00e8 \u003C?php print $start; ?\u003E ----- \u003Cbr\u003E\r\n\t\t\t \u003Chr\u003E\r\n\t\t\t  Lo Staff ti Aspetta!!!!\r\n\t\t\t   Puoi Verificare la tua registrazione al seguente link\u003Cbr\u003E\r\n\t\t\t   \u003Ca href=\u0022\u003C?php echo $base_url.\u0027\/registration\/\u0027.$list_item-\u003Eregistration_id; ?\u003E\u0022\u003EVedi Registrazione\u003C\/a\u003E\r\n\u003C\/h4\u003E\r\n\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003C\/tbody\u003E\r\n\u003C\/table\u003E\r\n\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003Ctr style=\u0022height: 68px;\u0022\u003E\r\n\u003Ctd style=\u0022text-align: center; height: 68px; width: 100%;\u0022\u003E\u003Chr width=\u002290%\u0022 \/\u003E\r\n\u003Ctable style=\u0022width: 100%; margin-left: auto; margin-right: auto;\u0022\u003E\r\n\u003Ctbody\u003E\r\n\u003Ctr\u003E\r\n\u003Ctd style=\u0022width: 70%; text-align: left;\u0022\u003E\r\n\u003Ch5\u003E[site:token-azienda]\u003C\/h5\u003E\r\n\u003C\/td\u003E\r\n[site:social-firma-email]\r\n\u003C\/tr\u003E\r\n\u003C\/tbody\u003E\r\n\u003C\/table\u003E\r\n\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003Ctr style=\u0022height: 23px;\u0022\u003E\r\n\u003Ctd style=\u0022text-align: center; height: 23px; width: 100%;\u0022\u003E\r\n[site:civatours-firma]\r\n\u003C\/td\u003E\r\n\u003C\/tr\u003E\r\n\u003C\/tbody\u003E\r\n\u003C\/table\u003E",
                  "language" : [ "" ]
                },
                "PROVIDE" : { "send_status" : { "send_status_no_accont" : "Send status" } }
              }
            }
          ]
        }
      }
    ]
  }
}