How to change the revision uid on node save I need to change the revison uid of 7000 nodes on a site. So I am using Views Bulk Operations to perform this action, by publishing or saving the the 7000 nodes concerned. Then I use the hook_node_presave to update all contents. But unfortunately, the field revision_uid isn't properly updated. By cons the field log is properly updated..

$field_uid = field_get_items('node', $node, 'uid');
    if($field_uid){
         $node-&gt;log = $node-&gt;uid;        
         $node-&gt;revision_uid = $node-&gt;uid;
    }


The revision id is still the one I'm using to make this operation (1 to admin..). How can get around this problem??
You'll have to impersonate a user while performing your operation:

&lt;?php
//Save current user data/session
global $user;
$original_user = $user;
$old_state = drupal_save_session(FALSE);

$field_uid = field_get_items('node', $node, 'uid');
    if($field_uid){
         // Load new $user data
         $user = user_load($node-&gt;uid);

         $node-&gt;log = $node-&gt;uid;        
         $node-&gt;revision_uid = $user-&gt;uid;
    }

// Fail safe - if your code fails session won't be saved
$user = $original_user;
//Rever to old user and save session
drupal_save_session($old_state);
?&gt;


References:


http://drupal.org/node/1082292
http://firedev.ro/blog/node-revision-when-doing-nodesave-gets-currently-logged-users-uid