Skip to content

Instantly share code, notes, and snippets.

@generalredneck
Created May 31, 2016 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save generalredneck/b31149e507d6a8a1c2231be5690d4c27 to your computer and use it in GitHub Desktop.
Save generalredneck/b31149e507d6a8a1c2231be5690d4c27 to your computer and use it in GitHub Desktop.
uuid: 50bbd2d6-7484-41a2-ad84-89cbd8985a92
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: 432Mt2nNnlfMIZYTGNK_R7jAm7qbJu0xPlTl0_6f5A0
id: upgrade_d7_user
migration_tags:
- 'Drupal 7'
migration_group: migrate_drupal_7
label: 'User accounts'
source:
plugin: custom_d7_user
process:
uid: uid
name: name
pass: pass
mail: mail
created: created
access: access
login: login
status: status
timezone: timezone
langcode: language
preferred_langcode: language
preferred_admin_langcode: language
init: init
roles:
plugin: migration
migration: upgrade_d7_user_role
source: roles
user_picture:
-
plugin: default_value
source: picture
default_value: null
-
plugin: migration
migration: d7_file
destination:
plugin: 'entity:user'
migration_dependencies:
required:
- upgrade_d7_user_role
optional:
- upgrade_d7_file
- upgrade_user_picture_field_instance
- upgrade_user_picture_entity_display
- upgrade_user_picture_entity_form_display
<?php
namespace Drupal\custom\Plugin\migrate\source\d7;
use Drupal\user\Plugin\migrate\source\d7\User as D7User;
/**
* Drupal 7 user source from database.
*
* @MigrateDrupalSource(
* id = "custom_d7_user"
* )
*/
class User extends D7User {
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('users', 'u');
$query->join('users_roles', 'ur', 'ur.uid = u.uid');
$query->fields('u')
->condition('u.uid', 0, '>');
->condition('ur.rid' array(1,2,3,4), 'NOT IN');
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment