function hook_bulk_user_registration_user_presave in Bulk User Registration 8
Allows to alter the user object after import of CSV data.
Typically used to set the value of extra imported fields.
Parameters
\Drupal\user\UserInterface $user: The user object.
array $data: The raw CSV data.
See also
hook_bulk_user_registration_extra_fields()
1 invocation of hook_bulk_user_registration_user_presave()
- BulkUserRegistration::createUser in src/
BulkUserRegistration.php - Creates and saves a user.
File
- ./
bulk_user_registration.api.php, line 40 - Hooks provided by the Bulk User Registration module.
Code
function hook_bulk_user_registration_user_presave(UserInterface $user, array $data) {
if (!empty($data['realname'])) {
$user
->set('realname', trim($data['realname']));
}
if (!empty($data['identifier'])) {
$user
->set('identifier', trim($data['identifier']));
}
}