The previous published revision should be available for the visitors while the current revision is in needs review state I am using Workbench Moderation module for moderation on nodes. I notice that it creates revision of the nodes.

I have a node which is in live/publish state therefore it is available for the site visitors. Then when an editor edit that node, I programmatically put that node in needs review state and create a new revision for that node.

After that the site visitors are not able to access that node until its state change to publish.

I want that the new revision should be needs review state and the previous publish revision of the node should be available to site visitors.

The code which I am using for setting the state of the node is as following.

$node-&gt;status = 0;
$node-&gt;revision = 1;
node_save($node);
workbench_moderation_moderate($node, 'needs_review');
I solved it.

Before the revisioning I loaded the original node first. Then first save the new revision and then save the original node.

My code now looks like this.

$original_node = node_load($nid);
$node = node_load($nid);
$node-&gt;revision = 1;
$node-&gt;workbench_moderation_state_new = 'needs_review';
node_save($node);
node_save($original_node);