I have a content type blog, it has several fields.If any one of the fields changes I want to call a function. How do I check even if one field has been changed. I tried checking comparing timestamp and revision_timestamp values available for $node and $node->original objects in hook_node_presave. But it did not help.
Can someone help me with this?

2 Answers 2


what you could do is add custom validate handler and in there load node

$my_node = node_load($form_state['nid']);

What this will do is load node with values that are currently in the database. of course you should make sure that above is not invoked if you are adding new node.

Now, you have your 'old' values in $my_node and 'about to be saved' values in $form_state['values']. Loop through both and compare values.

This is not the most effective way but it should work.

Use debug() from devel if you are not familiar with $form_state['values'].


See "node_form_submit" function in "node.pages.inc" which exists in node module(core). search with this word "@type %title has been updated.". Above this line try your function. I think this is just an option for your need.

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.