public function WordPressAuthor::__construct in WordPress Migrate 7.2
Set it up
Overrides WordPressMigration::__construct
File
- ./
wordpress_author.inc, line 16 - Support for migrating authors from a WordPress blog into Drupal.
Class
- WordPressAuthor
- Implementation of WordPressMigration, for authors
Code
public function __construct(array $arguments = array()) {
parent::__construct($arguments);
$this->map = new MigrateSQLMap($this->machineName, array(
'wp:author_login' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'WordPress author username',
),
), WordPressAuthorDestination::getKeySchema());
$fields = array(
'wp:author_id' => 'Unique WordPress ID of the author',
'wp:author_login' => 'Username (for login) of the author',
'wp:author_email' => 'Author email address',
'wp:author_display_name' => 'Displayed author name',
'wp:author_first_name' => 'Author first name',
'wp:author_last_name' => 'Author last name',
);
// Construct the source and destination objects.
$source_options = array(
'reader_class' => 'MigrateXMLReader',
'cache_counts' => TRUE,
);
$this->source = new MigrateSourceXML($this->wxrFile, '/rss/channel/wp:author', 'wp:author_login', $fields, $source_options, $this->arguments['namespaces']);
$this->destination = new WordPressAuthorDestination($arguments);
// The basic mappings
$this
->addFieldMapping('name', 'wp:author_login')
->xpath('wp:author_login')
->dedupe('users', 'name');
$this
->addFieldMapping('mail', 'wp:author_email')
->xpath('wp:author_email');
$this
->addFieldMapping('roles')
->defaultValue(DRUPAL_AUTHENTICATED_RID);
$this
->addFieldMapping('status')
->defaultValue(1);
// Unmapped destination fields
$this
->addUnmigratedDestinations(array(
'pass',
'theme',
'signature',
'signature_format',
'created',
'access',
'login',
'timezone',
'language',
'picture',
'init',
'is_new',
'role_names',
'data',
));
if (module_exists('path')) {
$this
->addUnmigratedDestinations(array(
'path',
));
}
// Unmapped source fields
$this
->addUnmigratedSources(array(
'wp:author_display_name',
'wp:author_first_name',
'wp:author_last_name',
'wp:author_id',
));
}