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.
Qoute from module description:
The authorship is set to the current user, the menu and url aliases are reset, and the words "Clone of" are inserted into the title to remind you that you are not editing the original content.
I downloaded and tested the dev-version from Oct. 26th and experience that the autorship is set to anonymous by default.
Also checked the rc1-version - there the authorship is set to the current user as expected.
Thanks for a nice and promising module!
Comment | File | Size | Author |
---|---|---|---|
#5 | 2124607-5.patch | 2.26 KB | pwolanin |
#1 | 2124607-1-author-cloned-again.patch | 1.96 KB | hanoii |
Comments
Comment #1
hanoiiThis was an issue introduced by http://drupalcode.org/project/node_clone.git/commitdiff/a8f11d644135201f...
He left the global $user outside of the function he proposed and only passed the uid which wasn't really used. Instead I went back to how it previously worked but allowing the same calling convention of the previous introduced work.
Comment #2
pwolanin CreditAttribution: pwolanin commentedI don't see how the patch fixes anything. Can you provide more clear steps to reproduce?
Comment #3
hanoiiSure, just create node, clone it (with dev) and you will see that the author field is empty, which means anonymous for the node system.
See below.
This is actually the line that makes all of the issue. Although the uid is stored in the node by that function, it also needs the user name, because that's really what the submit logic of a node form expects. There is no current $user object inside that function
In the commit above, where the patched committed moved the code into a function, it also moved moved the $user global object outside of the function and pass the uid to the function as an argument, but only the uid. He left, however, this line that was used before and made it work OK (current cloning user becoming the author of the cloned node).
I brought back the global $user to the function and removed the argument, which is actually cleaner, passing a global variable as an argument (or even a property of a global variable) makes no sense unless that function would ever need to receive a different $user object, which I don't think so.
Comment #4
pwolanin CreditAttribution: pwolanin commentedOk, it seems like I was trying to make that function more generic, but I see the bug now.
I think I didn't see it in local testing since I only tested as an admin?
Comment #5
pwolanin CreditAttribution: pwolanin commentedIndeed - the bug apparently only manifest using the pre-poplulate method as a non-admin
Here's a fix that's similar to yours, but retains the ability to specify the node author (might be a future action/VBO feature).
Comment #6
pwolanin CreditAttribution: pwolanin commentedcommitted. thanks for reporting the problem.