Redirect when editing a node that have a pending revision
| Project: | Revision Moderation |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
The attached patch fixes an issue when trying to edit a node that have a pending revision. In that case this module forces the load of the latests pending revision instead with a node_load() call, but by doing that the 'created' field is dropped if you save this pending revision.
Here is what happen:
1. Create a new revision of a node => this revision is now pending
2. Try to edit the node
3. node_form() is called, which calls node_object_prepare()
4. node_object_prepare() set correctly '$node->date' field (which will become the new 'created' node field if we submit the form)
5. node_invoke_nodeapi($node, 'prepare') is called
6. revision_moderation_nodeapi('prepare') is called, then the node is overriden because of a call to node_load()... so the $node->date info is lost
7. During the form display, the 'date' field is empty, and so if we submit the form we drop the 'created' node info... data loss !
So what I suggest is to redirect to the correct pending revision edition form, instead of calling node_load().
The patch prevents too a useless redirection (and probably a dead loop) when we are already trying to edit the latest pending revision (before that patch, a useless node_load() call was made as we already have the good $node).
| Attachment | Size |
|---|---|
| redirect_on_edit.patch | 1.91 KB |

#1
I can't recreate this. Anyone else?
#2
No response. Closing.
#3
Reopens this issue since this is a bug confirmed by aymerick, jromine and me.
This as a duplicate of#367283: Blank 'Authored on' field on re-edit of pending revision has been marked as duplicate of this issue.@add1sun: This bug is pretty hard to recreate. You'll have to disable Exempt administrators from revision moderation in the module configuration for this to work. Make sure that your user has administer nodes permission. Then repeat the steps aymerick describes above.
#4
+1 for the patch. It works perfect.