programmatically check if any field in a node is edited 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?
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'].