1

I want to send a message to users who have flagged, for example, the Toys taxonomy term. But only when a new node is created and contains the taxonomy term of Toys.

Any suggestions?

4
  • Have you tried the Rules module yet?
    – jan
    Commented Jul 17, 2014 at 4:00
  • yes, but can't figure out how to set it up.
    – No Sssweat
    Commented Jul 17, 2014 at 4:41
  • Are you still thinking (wondering) about to do this with the Rules module? Or is it only a matter of finding the time to ever "publish" your own answer using this module? Or would you rather want somebody else to add such answer? BTW: "merci" for your "support" that I seem to notice in the background of your profile picture ... which seems to be related to the "land-that-Drupal-(and-Dries)-originate-from"! Commented Apr 1, 2016 at 19:36
  • @Pierre.Vriens I got lazy in posting the answer since it was my own question, but if you would like to post the answer, feel free.
    – No Sssweat
    Commented Apr 1, 2016 at 23:07

1 Answer 1

1

I would create this using a Custom PHP code in Rules and execute the following conditional code on 'After saving new content of type...' event trigger :

if( count(taxonomy_get_term_by_name('[node:field-tags]')) ) return TRUE; 
else return FALSE;  

Then create an 'action to send an email'.

Requires
-PHP Filter,
-Rules.
-Here the content type assumes the default 'Article' with default Tags field 'field_tags'

{ "rules_tst" : {
"LABEL" : "Test Rule",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "php" ],
"ON" : { "node_insert--article" : { "bundle" : "article" } },
"IF" : [
  { "php_eval" : { "code" : "if( count(taxonomy_get_term_by_name(\u0027[node:field-tags]\u0027)) ) return TRUE; \r\nelse return FALSE;  " } }
],
"DO" : [
  { "mail" : {
      "to" : "[email protected]",
      "subject" : "test subject Toys confirmed!",
      "message" : "There are toys to play with!",
      "language" : [ "" ]
    }
  }
]

} }

I ahve included an importable for you to test.

1
  • oh, I found the solution to this using rules without any custom php. Thanks for taking the time to come up with a possible solution. Eventhough, I didn't get the chance to test your answer, I'll accept your answer as a token of gratitude
    – No Sssweat
    Commented Jul 17, 2014 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.