Вопрос

How can I import users fom a CSV file in Drupal 8?

I’ve found this module but it is not updated for Drupal 8:

https://www.drupal.org/project/user_import

I think that I can make an import directly with a MySQL script but is it possible with Drupal (I know I can insert datas directly into database but I don't know if Drupal system will allow that method)?

I’ve found this question but it is not exactly what i need : Importing a bunch of users from csv spreadsheet file into Drupal 8

I import data from a csv file and it is not a migration from a drupal site.

Это было полезно?

Решение

To make it with Migrate you need to setup Migrate Plus, Migrate Tools and Migrate Source CSV together, there is lot of examples in the web already:

http://valuebound.com/resources/blog/how-to-migrate-users-from-a-csv-file-drupal-8

https://agencychief.com/blog/drupal-8-csv-migration

https://www.mtech-llc.com/blog/lucas-hedding/migrating-using-csv

Другие советы

I think that I can make an import directly with a MySQL script but is it possible with Drupal (I know I can insert datas directly into database but U don't know if Drupal system will allow that method)?

Instead of MySQL this would be a Drupal method to insert users by using the Entity API:

$user = User::create([
  'name' => 'foobar',
  'mail' => 'foobar@example.com',
  'status' => TRUE,
]);
$user->save();

So if you don't want to use Migrate there are other ways for such a simple import task. You can use a php library of your choice to fetch the data and then add the user entities one by one. I answered a similar question for importing nodes at a time when Migrate was still in alpha: Is there a way to migrate only nodes?

Here I found the solution for it. Please follow this link https://github.com/steveoliver/user_import and install the extended module. You can import the user data file through this path (path: '/admin/people/import').

Лицензировано под: CC-BY-SA с атрибуция
Не связан с drupal.stackexchange
scroll top