When I try simple test by the steps
1. Export node where author is *User1* from my administrator account *Root*. Take a code;
2. Import this code and see what author of node is *Root* ???

Must be author of the node is *User1*

How can fix it ?

code that I have receive than export

<?
array(
  array(
    'nid' => '3684',
    'type' => 'manual',
    'language' => 'en',
    'uid' => '74',
    'status' => '1',
    'created' => '1273498673',
    'changed' => '1273498820',
    'comment' => '2',
    'promote' => '0',
    'moderate' => '0',
    'sticky' => '0',
    'tnid' => '0',
    'translate' => '0',
    'vid' => '3686',
    'revision_uid' => '1',
    'title' => 'ffff',
    'body' => '',
    'teaser' => '',
    'log' => '',
    'revision_timestamp' => '1273498820',
    'format' => '0',
    'name' => 'User1',
    'picture' => 'sites/default/files/pictures/picture-74.gif',
    'data' => 'a:4:{s:13:\"form_build_id\";s:37:\"form-7d5a843ccd71a4537d581754576033ff\";s:16:\"hs_form_build_id\";s:40:\"hs_form_5c6c639e39aa2f24484403a5e6134482\";s:14:\"picture_delete\";s:0:\"\";s:14:\"picture_upload\";s:0:\"\";}',
    'field_manual_pecht' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_format' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_oblogka' => array(
      '0' => NULL,
    ),
    'field_manual_content' => array(
      '0' => array(
        'value' => NULL,
        'format' => NULL,
      ),
    ),
    'field_manual_year' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_year_plan' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_kolstr' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_vidobl' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_isbn' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_tirag' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_udk_hs' => array(
      '0' => array(
        'value' => '18113',
      ),
    ),
    'field_manual_udk_code' => array(
      '0' => array(
        'value' => ' [658.512]',
      ),
    ),
    'field_manual_mon' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_pricepubl' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_status' => array(
      '0' => array(
        'value' => 'Готовится по плану',
      ),
    ),
    'field_manual_cifrprice' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_cifr' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_googlebooks' => array(
      '0' => array(
        'url' => NULL,
        'title' => NULL,
        'attributes' => FALSE,
      ),
    ),
    'field_manual_annotation' => array(
      '0' => array(
        'value' => NULL,
        'format' => NULL,
      ),
    ),
    'field_manual_recenzia' => array(
      '0' => array(
        'value' => NULL,
        'format' => NULL,
      ),
    ),
    'field_manual_10_15_el' => array(
      '0' => NULL,
    ),
    'field_manual_content_el' => array(
      '0' => NULL,
    ),
    'field_manual_lang' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'field_manual_sod_ann_rec' => array(
      '0' => array(
        'value' => '  ',
      ),
    ),
    'field_manual_year_plan_izd' => array(
      '0' => array(
        'value' => ' ',
      ),
    ),
    'field_manual_authr' => array(
      '0' => array(
        'nid' => '939',
      ),
    ),
    'field_manual_tegi' => array(
      '0' => array(
        'value' => NULL,
      ),
    ),
    'last_comment_timestamp' => '1273498673',
    'last_comment_name' => NULL,
    'comment_count' => '0',
    'taxonomy' => array(
      '5' => array(
        '18113' => '18113',
      ),
    ),
    'menu' => array(
      'link_title' => '',
      'mlid' => 0,
      'plid' => 0,
      'menu_name' => 'primary-links',
      'weight' => 0,
      'options' => array(),
      'module' => 'menu',
      'expanded' => 0,
      'hidden' => 0,
      'has_children' => 0,
      'customized' => 0,
      'parent_depth_limit' => 8,
    ),
    '#_export_node_encode_object' => '1',
  ),
)
        ?>

Comments

andrii_svirin’s picture

I read this in README.txt


INTRODUCTION
------------
The export module allows users to export a node and then import it to another
website. The authorship is set to the current user, the menu and url aliases
are reset.

But how can I fix it ?

andrii_svirin’s picture

I have found how to fix it

   // $node->name = $user->name;

  //  $node->uid = $user->uid;

danielb’s picture

Title: Do not work correctly » Set author to another user
Category: bug » feature
Priority: Critical » Normal

The readme was plagiarized from the clone module, it probably needs updating.

Anyway this isn't a bug it was a deliberate design choice, but perhaps a bit of a cop out. Node export can't assume the user id from the node exists on the new site, or is the same user. We could provide more options in the import form to import as a selected user, current user, keep the uid the same, or use root user.

It is really the same type of dilemma as the nid 'problem' people have been asking about.

andrii_svirin’s picture

I use this module for export from some XML-file. In my task was not export to another site. So I have individual task. But maybe it would be useful for somebody

danielb’s picture

Title: Set author to another user » Handle Authors
danielb’s picture

Status: Active » Postponed
adrianmak’s picture

#2
What does mean of

 // $node->name = $user->name;

  //  $node->uid = $user->uid;
djdevin’s picture

Would it be so bad to look up the user's name (in the node object) during the import then use the UID?

danielb’s picture

It's a security risk to automate it based on any property, including the username or uid, without giving the admin a choice or chance to change this.

sandfurz’s picture

danielb’s picture

Version: 6.x-2.21 » 7.x-3.x-dev
Component: Node Export » Node export

Development of features on this module will now be focused on 7.x-3.x-dev, with backports possible after fixing.

danielb’s picture

Issue has come again in #1539008: Retain author information

danielb’s picture

Status: Postponed » Closed (duplicate)

I'm going to try to solve this problem by integrating with entity_dependency
#1586204: Improve dependency handling
It is a more generic solution, so that is something definitely worth putting the effort into.

bisonbleu’s picture

Just a quick note about #10.

I was able to copy/paste components of that patch into 6.x-3.4. The first part of the patch goes into node_export.pages.inc. The second part gos into node_export.module. Seems to work. I see no errors. At first glance, created nodes behave normally.

This works for me because admin is the only user who has access to the node_export features. Also, the 'node_export: import' is performed locally.

Cheers