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!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hanoii’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.96 KB

This 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.

pwolanin’s picture

I don't see how the patch fixes anything. Can you provide more clear steps to reproduce?

hanoii’s picture

Sure, 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.

+++ b/clone.pages.inc
@@ -202,9 +200,7 @@ function _clone_node_prepare($original_node, $prefix_title = FALSE, $uid = NULL)
   $node->name = isset($user->name) ? $user->name : NULL;

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.

pwolanin’s picture

Ok, 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?

pwolanin’s picture

FileSize
2.26 KB

Indeed - 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).

pwolanin’s picture

Status: Needs review » Fixed

committed. thanks for reporting the problem.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

  • Commit 327cdda on 7.x-1.x, 8.x-1.x by pwolanin:
    Issue #2124607 by hanoii, pwolanin: Fix for Node author set to anonymous...