I have Workbench setup to use a Content Editor (writes and edits content) and a Content Moderator (approves and publishes). Work flows from Draft to Needs Review to Published. Nothing fancy. Everything works fine for all the content types except for the book pages. The Content Editor can go to a book page and click the tab that says "New Draft" and then make changes, but once they save the changes the page is basically in limbo. There is no way for the Content Editor to change the page status to "Needs Review." If you go to the "My Workbench" area the page shows up as being in draft mode, but you can't edit it further or change the state. All you can do is create another new draft that also ends up in limbo. I have enabled "create new revision" and "Enable moderation of revisions " in my Book Page settings and the Content Editor has permission to create and edit book pages.
I could really use some help.
| Comment | File | Size | Author |
|---|---|---|---|
| #41 | extra_revision-1505060-41.patch | 3.22 KB | wildfeed |
| #37 | extra_revision-1505060-37.patch | 3.79 KB | wildfeed |
| #36 | extra_revision-1505060-35.patch | 3.79 KB | wildfeed |
| #26 | extra_revision-1505060-26.patch | 3.23 KB | joegraduate |
| #21 | workbench_moderation-1505060-21.patch | 3.04 KB | star-szr |
Comments
Comment #1
ericras commentedI can confirm this with a fresh 7.12 install with Workbench Moderation 7.x-1.1+9-dev (Apr10).
It affects any node assigned to a book. (Pages of the "Book" content type that are not assigned to a book are fine.)
Attached screenshots show two pages, each created by an admin and immediately published, then edited and saved by a content editor that can only save to the Draft state:
- First attachment (Basic Page 1) shows what we should get.
- Second attachment (Book Page 1) shows what happens when a page is part of a book. Revision 19 should not exist (it was published by Anonymous????) and revision 18 should be shaded red and awaiting moderation.
Revision 19 (vid=19) exists errantly in the node_revision DB table and it's log message is a dupe of 17's. The workbench_moderation_node_history table is ok, it has no entry for vid=19 hence Anonymous is listed as the user who made the moderation change.
Comment #2
ericras commentedI've traced the meat of the problem to book_node_presave() which declares "Always save a revision for non-administrators" and sets $node->revision=1. Related: #261319: Book page update always creates revision?
I'm thinking about undoing that in workbench_moderation_node_presave() which appears to be called after book_node_presave() but I'm not knowledgeable about call order of hook functions i.e. will workbench_moderation_node_presave always be called later than book_node_presave? is it alphabetically??
Edit: I see it looks like module_invoke_all call order is based on weight in the system table. Book:0, WBM: 5.
Comment #3
ericras commentedHere's a patch that solves the problem for me.
Comment #4
ComboPrime commentedJust want to confirm that the patch solved this issue for me as well. Thank you!
Comment #5
rosk0solved this issue for me as well.
Comment #6
lodey commentedThis worked for me too - using latest dev version
Comment #7
tamasd commentedI can confirm this working with the 7.x-1.2 version.
Comment #8
jhedstromI can also confirm that #3 works for book pages.
Comment #9
ericras commentedComment #10
stevectorTagging for this week's Workbench sprint. This patch should include a test.
Comment #11
kbentham commentedI am having trouble reproducing this error. Can you please give more detailed steps as to how to reproduce the error, as well as the version numbers of Workbench Moderation and Drupal core that you are using?
Comment #12
hazah commentedHey there, same issue, patch works!
WBM: 7.x-1.3
Core: 7.19
Revision history shows your draft *second*, with another, newer, draft by anonymous which is set to be the current published version.
There is no tab to edit the draft you have attempted to create in step 4. Only option is to create another new draft (which ends up repeating the problem again).
There is no moderation options to place the draft as published.
Edit/Revert/Delete are gone, only user can only view.
Let me know if any step is not clear.
Comment #13
ericras commentedTo reproduce:
Latest core 7.x dev from git (e01afb83bc7bffc84ddda0d3b3da7b505aedeed7)
Latest workbench (16a8fff3c80a10102711d5c92625e67879e333dd)
and workbench_moderation (d19698957c76d236b0967151b689a23b4f766ad0)
from git 7.x-1.x
Attached is the permissions for my 'content editor' role - the limited access user that needs their edits moderated.
1. Enable Book and Workbench Moderation and enable moderation of revisions on the Book Page content type.
2. Create 'Content Editor' role and set permissions according to screenshot
3. Administrator creates a new Book Page and on the node/add/book form:
- Book outline: select 'create a new book'
- Publishing options: Moderation State: Published
- Save
4. User with only 'Content Editor' role creates a new draft of that page and saves.
The result is the 'wrong' screen shot in comment #1 where the Content Editor user is able to publish and moderation actions are attributed to Anonymous. The result should be the 'correct' screen shot.
Comment #14
jhedstromComment #15
waako commentedThis is still a requirement for Workbench Moderation to work with Book.
Issue still exists with latest version of dev release (2013-Jun-13)
Patch worked a treat thank you ericras
Comment #16
ewlyn commentedI am running Workbench Moderator 7x-1.3 and running into almost the same issue ericras did.
Workbench is working fine everywhere else on the site, but if I access a book child page, there is only the option to view. Revert and delete have vanished. Also, if a user creates a new draft, it creates duplicates which have no moderation actions and, when one tries to view them, one is shown the current published version. One can publish the draft to get it to show up on the site, but saving it as a draft or in need of review puts it in limbo.
Curiously, if I go to moderate the content page for the book, everything works as it should.
I tried applying the patch, but can't seem to get it to work with 7x.1-3. (It either causes zero change to the site or throws errors at me... but this might partly be my lack of experience with coding/my guessing where it might go in the 7x-1.3 code.)
Attached are two screen shots. One showing the content page view with everything working and one showing the child page view with all the missing options and the strange phantom ghost pages.
Any help would be much appreciated. Thank you!
Please let me know if there is any other information I can provide.
Comment #17
hass commentedComment #18
ewlyn commentedOne additional bit of wonkiness I have noticed while trying to find a way to resolve this.
When a user with complete access edits a book page, that page begins behaving correctly. The revert and delete options reappear and the extra limbo pages vanish and become pages which either require moderation or can be reverted depending on if they have previously been published. All users with access to that page can now view the moderation queue as it should be.
However, once a user with a more limited access role creates a new draft, that page of the book immediately begins acting oddly again with their draft going back into limbo and the revert and delete options vanish again. All users with access to that page now view the wonky moderation queue again.
I've upgraded to the dev version 7.x-1.3+6-dev. Still having these problems.
Comment #19
jojonaloha commentedI've also experienced this issue and noticed it only when the user didn't have the 'Administer content' permission. As ericras said, it is caused by an incompatibility with book.module.
If we look at the relevant code in book_node_presave(), we can see that this is caused when the book module is enabled and the user does not have the 'administer nodes' ('Administer content' in the UI) permission.
The patch in #3 works for me using 7.x-1.3.
@ewlyn it sounds like you are having trouble applying the patch, for me it applied clean to 7.x-1.3 though. Try https://drupal.org/node/60108
Moving to 'needs work' since it was already RTBC and according to #10 needs tests still.
Comment #20
mparker17Adding a related issue
Comment #21
star-szrHere's a test case, this should pass/fail.
Comment #23
star-szrFridays. Fail/pass I mean, and it did! :)
Reviews please.
Comment #24
ben.bunk commentedThe patch in #21 applied cleanly and fixed the issue for us against 7.x-1.3 but there was a 403 access denied error in the test case trying to access this page: /node/1/moderation/1/change-state/needs_review?token=dSg9nrtNLWZpA62DBRYfIH0HDj5IVW9mHjFBDe66RYk
Comment #25
netsliverThe patch not work for me, I removed the lines in book.module, work very well.
Comment #26
joegraduateThe patches in #3 and #21 no longer apply correctly to the latest released version (7.x-1.4) or the latest dev.
The attached patch is a re-roll of #21 with some minor modifications. It applies cleanly to both the latest dev and released version and fixes the issue for me.
Comment #27
star-szr@joegraduate it would be great if you could expand on (or provide an interdiff for) the minor modifications :) thanks!
Comment #28
joegraduate@Cottser, sorry about that. The only real difference was that I moved a comment to a different line so that the code block that this patch adds to workbench_moderation_node_presave() fits in better with another code block that has been added to that function since the original patches were created. I didn't change any of the test code added in #21.
Comment #29
star-szrNo worries, sounds reasonable :) thanks!
Comment #30
agileadamThe patch in #26 worked for me. Thank you.
Comment #31
cspiker commented#26 tests out for us as well.
Comment #32
Ryan S commented#26 works great! Thank you! Our entire site uses book pages, so this is a very welcome fix.
Comment #33
jojonaloha commentedMoving to RTBC.
Comment #34
dman commentedWay too many hours I lost before I found myself with enough evidence to locate the exact issue was the one reported here!
Issue still present in Workbench Moderation 7.x-1.4
* A 'moderator' user with the correct permissions for workflow stages but not 'administer content'
* tries to save a new draft of already published content
* draft gets saved (according to the watchdog) but is immediately overwritten by the published 'original' with a new revision ID making the reversion the new 'current' version.
* Traced to the $node->revision flag, and subsequently to the func identified back in 2013 by @jojonaloha
Patch still applies well. Patch resolves problem!
RTBC, and mad frustrating to trace and replicate when it's all about an unrelated permission and an unrelated module that triggers this.
Comment #35
richgerdesVerified that this patch still applies to the current head of the 7.x-1.x branch and solves the issue. Patch can be merged.
Comment #36
wildfeed commentedHere is a patch that can be applied to version 7.x-3.0. workbench_moderation_node_presave is now handled by workbench_moderation_entity_presave. The patch in #27 has been modified so the code is runs when hook_entity_presave runs and modifies $entity instead of $node. Worked for me!
Comment #37
wildfeed commentedLet's try this again as - Same patch but naming it #37
Comment #40
richgerdes@wildfeed,
Please ensure that your patch works against the dev version of 3.x, it if you built the patch around 3.0, there have been changes since 3.0 was released.
Comment #41
wildfeed commentedRecreated patch
Comment #42
richgerdesRunning tests.