Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In my case, user can flag a term. A rule fetches users who flagged a term.
Now can i use several numbers in the Data-Selector.
Now i've [node:field-rubriek:2]. I could also use :0, :1 and :3.
See screenshot
What is the purpose of these numbers?
At the bottom is my export of the rule. It's sending mails to users who have flagged a taxonomy-term. When someone adding a node with a taxonomy-term, subscribed users are getting a mail.
When using :0, only users from the first term are mailed.
Didn't test it further,
{ "rules_send_mail" : {
"LABEL" : "Send mail",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "flag" ],
"ON" : { "node_insert" : [] },
"IF" : [
{ "node_is_published" : { "node" : [ "node" ] } },
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_rubriek" } }
],
"DO" : [
{ "flag_fetch_users_taxonomy_term" : {
"USING" : {
"flag" : "inschrijven_rubriek",
"taxonomy_term" : [ "node:field-rubriek:2" ]
},
"PROVIDE" : { "users" : { "gevlagdegebruikers" : "Users who flagged" } }
}
},
{ "LOOP" : {
"USING" : { "list" : [ "gevlagdegebruikers" ] },
"ITEM" : { "list_item" : "Current list item" },
"DO" : [
{ "drupal_message" : { "message" : [ "list-item:mail" ] } },
{ "mail" : {
"to" : [ "list-item:mail" ],
"subject" : "Nieuw bericht [node:title] op [site:name]",
"message" : "Lees meer op [node:url]",
"language" : [ "" ]
}
}
]
}
}
]
}
}
Comment | File | Size | Author |
---|---|---|---|
#2 | screenshot-2016-03-05-21-26-19.png | 92.27 KB | MatthijsG |
Comments
Comment #2
MatthijsG CreditAttribution: MatthijsG as a volunteer commentedComment #3
MatthijsG CreditAttribution: MatthijsG as a volunteer commentedComment #4
TR CreditAttribution: TR commentedYou seem to have figured this out long ago:
https://www.drupal.org/forum/support/post-installation/2015-10-02/rules-...
https://drupal.stackexchange.com/questions/217223/solved-send-mail-with-... https://www.drupal.org/node/2815377
and a more up-to-date answer: https://www.drupal.org/project/rules/issues/2842303
Comment #5
TR CreditAttribution: TR commented