Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello
I used node clone and workbench moderation on my site. And I got problem.
When I cloned node, also was cloned property of node - $node->workbench_moderation. After that in function workbench_moderation_node_live_load, executed this code
node_load($node->nid, $node->workbench_moderation['published']->vid, TRUE);
Used nid of new node, and vid of the source node. This node cannot be loaded.
I think, that property $node->workbench_moderation should not be cloned.
Comment | File | Size | Author |
---|---|---|---|
#10 | published-draft.png | 9.31 KB | farse |
#9 | workbench-3.0.png | 64.45 KB | farse |
#8 | workbench-1.4.png | 67.29 KB | farse |
#7 | published-tab.png | 3.36 KB | farse |
#7 | moderate-bug.png | 10.97 KB | farse |
Comments
Comment #1
eugene.ilyin CreditAttribution: eugene.ilyin commentedI prepared simple patch to solve this problem
Comment #2
das-peter CreditAttribution: das-peter commentedI think this should be fixed in the clone module itself as this exactly its core business.
The clone module know's when it's cloning (no need for hacky stuff like this
arg(2) == 'clone'
).And it should know what to clone and what not - again that's its core purpose.
Btw. if there's a "clone API" / a hook that would allow us to define non-clonable properties we could think about implementing it.
Comment #3
ladybug_3777 CreditAttribution: ladybug_3777 commentedI know this is marked as "won't fix" but I'm just curious if my issue is the same as this one. When I clone a node that is using Workbench Moderation I get the following errors/warnings in my log files:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7818 of MYDRUPALROOT\includes\common.inc).
Warning: Creating default object from empty value in workbench_moderation_store() (line 1787 of MYDRUPALROOT\sites\all\modules\contrib\workbench_moderation\workbench_moderation.module).
Do you see this same error or are you seeing something different? Also this error is ONLY in the logs, it doesn't display on the screen and the item appears to be cloned just fine.
Comment #4
ladybug_3777 CreditAttribution: ladybug_3777 commentedFYI I opened up an issue on the Node Clone page: https://www.drupal.org/node/2501357
Comment #5
fengtan@das-peter How about implementing
hook_clone_node_alter()
? See patch attached.Comment #6
fengtanComment #7
farse CreditAttribution: farse at Zoocha commentedI have noticed this issue updating from 1.4 to 3.0 due to the security updates. If a node is cloned it gets automatically saved as published even though in the moderation history is shows as saving to draft
Comment #8
farse CreditAttribution: farse at Zoocha commentedUsing hook_clone_node_alter() did not work for me. It only made the cloned version look as though it was a draft, but this draft was still being published. Looking at the $node vari in the hook, it is the same in the 1.4 and 3.0 versions, so I think the problem lies elsewhere in the module as the differences are found after the cloned node is saved.
Comment #9
farse CreditAttribution: farse at Zoocha commentedMeant to add my 3.0 version image along with comment #8
Comment #10
farse CreditAttribution: farse at Zoocha commentedalso for comment #8, the result of using the hook_clone_node_alter()
Comment #11
farse CreditAttribution: farse at Zoocha commentedThis is the code that worked for me for version 3.0, although it's not a 'fix' in the module itself.