I need to compare the before save/update value with the after save/update value of a node field.
ExExample: There is an already existing node with the title of "Hello". I then edit the node and change the title to "World".
I need to get the before value of "Hello".
function mymodule_node_presave($node){
$before = $node->title;
drupal_set_message($before, 'error');
}
function mymodule_node_update($node){
$after = $node->title;
drupal_set_message($after, 'warning');
}
But I always keep getting the same value...
Did I just discover a drupal bug? or what? Because I've used this method in the past with user hooks and it works as expected:
function mymodule_user_presave(&$edit, $account, $category) {
$before = $account->field_custom['und'][0]['value'];
drupal_set_message($before, 'error');
}
function mymodule_user_update(&$edit, $account, $category) {
$after = $account->field_custom['und'][0]['value'];
drupal_set_message($after, 'warning');
}