public function MigrateProfileUserHandler::prepare in Migrate 6.2
File
- plugins/
destinations/ profile.inc, line 38 - Support for profile.module fields as a destination.
Class
- MigrateProfileUserHandler
- Destination class handling profile.module data.
Code
public function prepare(stdClass $account, stdClass $row) {
if (module_exists('profile')) {
static $fields;
if (!isset($fields)) {
$fields = array();
foreach (profile_categories() as $category) {
$result = _profile_get_fields($category['name'], FALSE);
while ($field = db_fetch_object($result)) {
$fields[$field->name] = $field;
}
}
}
foreach ($fields as $key => $field) {
if (isset($account->{$key})) {
switch ($field->type) {
case 'date':
$timestamp = MigrationBase::timestamp($account->{$key});
$account->{$key} = array(
'month' => date('n', $timestamp),
'day' => date('j', $timestamp),
'year' => date('Y', $timestamp),
);
break;
default:
}
}
}
}
}