I am using a content type called "question" which has an organic group reference field (og_group_ref
).
I want to trigger an action with Rules, when the field "og_group_ref
" is changed on node update.
So I have created the following rule:
{ "rules_notify_question_author" : {
"LABEL" : "Question has moved - notify user",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update--question" : { "bundle" : "question" } },
"IF" : [
{ "AND" : [
{ "NOT data_is" : {
"data" : [ "node-unchanged:og-group-ref" ],
"value" : [ "node:og-group-ref" ]
}
}
]
},
{ "NOT data_is_empty" : { "data" : [ "node:og-group-ref" ] } }
],
"DO" : [
{ "mail" : {
"to" : "[node:author:mail]",
"subject" : "Some handy subject",
"message" : "E-Mail to author",
"from" : "[site:mail]",
"language" : [ "" ]
}
},
{ "drupal_message" : { "message" : "Message text" } } } }
]
The idea is that the author of a question gets notified, when the questions was moved to another group. The logic should be like this:
EVENT: On Node question Update
CONDITION: node_unchanged:og-group-ref != node:og-group-ref AND node:og-group-ref != EMPTY
ACTION: Send Mail an show a message
My problem is, that the rule fires when the content of the field og_group_ref was changed and when it was NOT changed.
I printed the compared values in the drupal message. The values are correct. But I do not know, why the rule is triggered although the field "og_group_ref
" did not change.
Has anyone an idea?