function nodeaccess_node_update in Nodeaccess 7
Implements hook_node_update().
Parameters
Object $node:
File
- ./
nodeaccess.module, line 644 - Provide per node access control
Code
function nodeaccess_node_update($node) {
if (module_exists('user_reference')) {
$fields = variable_get('nodeaccess_' . $node->type . '_user_reference', array());
foreach (array_keys($fields) as $field_name) {
if (isset($node->{$field_name})) {
$old_node = node_load($node->nid);
// Delete the old user as it's changed.
if ($node->{$field_name} != $old_node->{$field_name}) {
nodeaccess_delete_user_reference($old_node);
nodeaccess_insert_user_reference($node);
}
break;
}
}
}
// Done, author permissions are not written into nodeaccess.
}