将用户数据从django迁移到drupal 7

时间:2016-08-28 06:52:52

标签: django drupal-7

有没有办法将用户数据从django迁移到drupal-7。我在旧的Django网站上有800个用户,并希望将这些用户迁移到drupal-7。请提出一些技巧或教程。我google了很多,但无法找到任何直接的解决方案。

感谢您的帮助和建议。

1 个答案:

答案 0 :(得分:0)

I believe there is not an module for this, specifically. But the migrate module can help you with the migration. It demands that you create some code for the migration. But it is necessary only if your users have a lot of custom fields.

If they are simple users (username/email/password), you only would need to make a simple script to create users. In that case, you can use the drupal_bootstrap to start it from an external script and with user_save create the users.

<?php
define('DRUPAL_ROOT', '/path/to/drupal');
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_boostrap(DRUPAL_BOOTSTRAP_FULL);

//set up the user fields
$fields = array(
   'name' => 'user_name',
   'mail' => 'user_name@example.com',
   'pass' => $password,
   'status' => 1,
   'init' => 'email address',
   'roles' => array(
     DRUPAL_AUTHENTICATED_RID => 'authenticated user',
   ),
);

//the first parameter is left blank so a new user is created
$account = user_save('', $fields);