While using this module and in particular sending email using PHP replacement for new content created I found that $node->nid is NULL.

I have inserted var_dump($node); in my email and received this email and the $node object contains just a few values, while most of them are empty. Inserting the output of var_dump() in the email:

##################################################################
object(stdClass)#26 (42) {
["nid"]=>
NULL
["vid"]=>
NULL
["uid"]=>
string(2) "22"
["created"]=>
int(1231380749)
["type"]=>
string(11) "stormticket"
["language"]=>
string(2) "en"
["changed"]=>
string(0) ""
["organization_nid"]=>
string(3) "193"
["project_nid"]=>
string(3) "200"
["task_nid"]=>
string(1) "0"
["ticketcategory"]=>
string(3) "bug"
["ticketstatus"]=>
string(8) "inserted"
["ticketpriority"]=>
string(5) "1-low"
["title"]=>
string(10) "Test Seven"
["datebegin"]=>
array(3) {
["month"]=>
string(1) "1"
["day"]=>
string(1) "8"
["year"]=>
string(4) "2009"
}
["dateend"]=>
array(3) {
["month"]=>
string(2) "-1"
["day"]=>
string(2) "-1"
["year"]=>
string(2) "-1"
}
["durationunit"]=>
string(5) "month"
["duration"]=>
string(0) ""
["pricemode"]=>
string(1) "-"
["price"]=>
string(0) ""
["currency"]=>
string(1) "-"
["body"]=>
string(0) ""
["format"]=>
string(1) "1"
["title_old"]=>
string(0) ""
["name"]=>
string(9) "TomV"
["date"]=>
string(0) ""
["status"]=>
bool(true)
["promote"]=>
bool(false)
["sticky"]=>
bool(false)
["op"]=>
string(4) "Save"
["submit"]=>
string(4) "Save"
["preview"]=>
string(7) "Preview"
["form_build_id"]=>
string(37) "form-976ff49863794cf40d22003369f50f"
["form_token"]=>
string(32) "9d502574a3ae3250888df01c26fb4f"
["form_id"]=>
string(21) "stormticket_node_form"
["comment"]=>
string(1) "2"
["menu"]=>
array(13) {
["mlid"]=>
int(0)
["module"]=>
string(4) "menu"
["hidden"]=>
int(0)
["has_children"]=>
int(0)
["customized"]=>
int(0)
["options"]=>
array(0) {
}
["expanded"]=>
int(0)
["parent_depth_limit"]=>
int(8)
["link_title"]=>
string(0) ""
["parent"]=>
string(21) "menu-ticket-support:0"
["weight"]=>
int(0)
["plid"]=>
string(1) "0"
["menu_name"]=>
string(19) "menu-ticket-support"
}
["path"]=>
string(0) ""
["upload"]=>
string(0) ""
["attach"]=>
string(6) "Attach"
["teaser"]=>
string(0) ""
["validated"]=>
bool(true)
}
Organisation:
Project:
Title: Test Seven

Comments

amitaibu’s picture

Component: Rules Core » Rules Engine
Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

1) My assumption is that your Rule is runing after event 'Content is going to be saved', in this case your node still does not have a nid, since it wasn't inserted to the DB yet. You can use the event 'After a content was saved'.
2) btw, You can also use token replacement for this, instead of PHP.

fago’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

I think it's 1). I'll add that to the FAQ.