public function ImportBaseUsers::prepareRow in Import 7
Default implementation of prepareRow(). This method is called from the source plugin upon first pulling the raw data from the source.
Parameters
$row: Object containing raw source data.
Return value
bool TRUE to process this row, FALSE to have the source skip it.
Overrides Migration::prepareRow
File
- ./
import.base.users.inc, line 52 - Contains base user migration class.
Class
- ImportBaseUsers
- @file Contains base user migration class.
Code
public function prepareRow($row) {
$user_roles = explode(",", $row->roles);
$roles = array(
'2' => '2',
);
foreach ($user_roles as $role_name) {
$rid = db_query('SELECT rid FROM {role} WHERE name = :name', array(
':name' => $role_name,
))
->fetchField();
$roles[$rid] = $rid;
}
$row->roles = $roles;
return TRUE;
}