You are here

function get_user_id in Content Import 8.9

To get user id.

1 call to get_user_id()
import_node in ./contentimport.module
To import data as Content type nodes.

File

./contentimport.module, line 131
Module file for Contentimport.

Code

function get_user_id($name) {
  $user_id = \Drupal::database()
    ->select('users_field_data', 'u')
    ->fields('u', [
    'uid',
  ])
    ->condition('u.name', trim($name))
    ->execute()
    ->fetchField();
  return $user_id;
}