Closed (fixed)
Project:
Node export
Version:
6.x-2.x-dev
Component:
Node export
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2009 at 13:48 UTC
Updated:
9 Mar 2013 at 18:04 UTC
Jump to comment: Most recent file
Comments
Comment #1
danielb commentedThis doesn't make sense. A uid is a meaningless piece of data that could lead to false user matches. This is why it is removed.
Comment #2
joachim commentedIt depends on the case, surely?
Comment #3
danielb commentedI don't see how. The uid is specific to the site you exported from, you can't guarantee they will have the same ID on the new site, or that they will even exist. The only way to guarantee this is if you have somehow exported users as well, such as by copying the database - which begs the question; why aren't you using the same technique for nodes?
Additionally, this isn't just a limitation of node_export, it's a limitation of drupal.
Observe the source of this function: http://api.drupal.org/api/function/node_save/6
The call to _node_save_revision() forces the currently logged in user to be the author of the node.
The only option to change this is to write a custom version of node_save(), which is possible, but without being extremely clever with it you will wind up assigning nodes to the wrong user because they happen to have the right ID.
Comment #4
joachim commentedAh, fair enough. I guess that means with drush we import as uid 1, or provide an option.
Comment #5
joachim commentedOh hang on, there *would* be a way to spoof that -- before node_save is called, do:
But there are most likely some hairy security implications, so best left alone!
Comment #6
sandfurz commentedIf someone is still interested, try this patch (6.x-2.21).
Make sure to trigger the new checkbox "retain original author's user id ... " on admin/settings/node_export.
... recently, I had to migrate some users along with their corresponding nodes (content profile) by just dumping the users-table. So it was very, very useful to retain their original user id. :-)
Comment #7
alexku commentedPatch worked for me, thanks.
This feature is useful if you need to move content_profile nodes with users.
Comment #8
hedac commentedthank you sandfurz.
It makes sense to me to maintain author... when working on copies of the same site where you know users are the same. developement and live versions for example.
Comment #9
aubjr_drupal commentedI'm working in a system of sites where there's a single sign on authentication across all the sites. As a result, the user 'name' is forced to be unique across all sites connecting to the auth system. That means that the $node->name is unique, from Site A to Site B, but the uids vary between A and B, as they are generated individually, at different times. (It's not the best system, but it's what we have.)
Therefore, the ability in site B to check $node->'name' from nodes being imported from site A, and update the $node->uid to the uid assigned to the matching name in B, would be really helpful.
This patch above lays the foundation for a good way to do it, with a tweak to the db_fetch_object and the logic to test $_users for the $node->'name'.
I realize that my user name/authentication situation is probably not the norm, but would it be possible to add this ability to the module (I'm using 6.x-3.2), as long as an admin could turn off the feature (and have it off by default)?
Comment #10
bcobin commentedRunning into this issue now - any hope for a D7 version? Thanks...
Comment #11
vcrkid commented#6 can be used with 6.x-3.4 by doing the following:
1) The first part of the patch goes into node_export.pages.inc.
2) The second part gos into node_export.module.
3) Select the new checkbox "retain original author's user id ... " on admin/settings/node_export
Thanks to sandfurz (for the original patch) and to bisonbleu (for tips on adapting it)!!!
That's what I call open-source teamwork!
Comment #12
vcrkid commented