Send mail to "parent node" of a comment

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

Hi,
I have a node type called "big", this node type can have comments of type "small" (using the node comment module).

"big" have a cck field called "emailfield", users who create "big" are not registred, they enter there emails on "emailfield" when they create the node.

What I whould like to do is to have rules send a mails to "emailfield" of "big" when a comment "small" is created for it.

Can you help me doing that ?

Regards,

Comments

Some steps

itangalo's picture

Here's a recipe for sending the e-mail you want:

  • Create a rule that triggers when a node is created
  • Set conditions so it is only activated when the created node is "small"
  • Create an action, loading a new node -- I think you will need token to get the nid value of the big node, but I'm not sure. (I'm assuming there is a node reference going from "small" to "big".)
  • Create another action "send e-mail to arbitrary e-mail address", and again use tokens to get the e-mail address from the relevant field.

You'll probably want to use tokens for parts of the message that is sent as well.

Good luck!
//Johan Falk, NodeOne, stuck in Sweden because of a volcano

Hello, Thank you, my probleme

LeMale's picture

Hello,

Thank you, my probleme is that I don't know how to get the NID of the parrent "big", when I use the token [node:nid] it returne the nid of the published "small", I took a look at the dababase for any similarity between the nids of a "big" at it's "small"s, I find the relation in the node_comments table, any idea how to use it to solve the probleme or another way ?

Regards,

Load the node

itangalo's picture

There is an action called "load a node" or something like that. If you invoke that rule you'll be able to load the Big node from the Small one.

Good luck!
//Johan Falk, NodeOne, not at DrupalCon but in Sweden, due to the volcano

Rules

Group organizers

Group categories

Categories

Group notifications

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