I am using the Rules module to send an email. I need to include a CCK field from my node in the email. The rules module provide a $node object. How do I get from this object to my field so I can output it in the email?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can debug it by dumping the node object like so:
Or (my preference) you can use the dBug.php script from http://dbug.ospinto.com/ include that script and do
It will make the dump easier to read.
Anyway, your node object will have the CCK fields in it marked as field_(name). So if you had a CCK field called Telephone, it would be in the node object as field_telephone with its own properties.
If these fields are missing, the node may not be fully loaded. I’ve seen that happen. If so, you can simply do:
That would have a fully loaded node object. Then just point to the correct field in your email script/tpl, however you are doing it, and if there is a value it will be sent.