I have a site that has a complex set of permissions and roles to support a workflow we have defined with Workbench Moderation. This particular workflow has the "normal" three states:
- Draft
- Needs Review
- Published
The workflow is set up to allow both forward progression through the workflow (eg, Draft to Needs Review) and also backwards (eg, Needs Review to Draft). The site also uses the basic features in Workbench, and content creators like the My Content, My Drafts, and Needs Review, etc, pages / views that it provides.
OK, here is my problem. One of the common tasks are editors pushing nodes back to Draft status for original authors to do major work on. The problem is that if you examine node_save
, revisions have their $uid
set to the used who did the save (ie, $user->uid
). In this case, it would be the editor. Therefore, the new draft shows up in the editor's queue and not the original author's (if you examine the view for this page, you can verify this behavior).
I am curious whether others have run into this problem and how they solved it.
Using a hook_node_presave
to set the isn't an option, as it fires too soon, and node_save
would nuke any changes, anyway.
I suspect that I could do a hook_node_update
, eg
function mymodule_node_update ($node)
{
db_update('node_revision')
->fields(array('uid' => $node->uid))
->condition('nid', $node->nid)
->condition('vid', $node->vid)
->execute();
}
but I am worried that there may be side effects that I am not considering.
Are there better options?