You are here

function _photos_access_user in Album Photos 8.4

Same name and namespace in other branches
  1. 7.3 photos_access/photos_access.module \_photos_access_user()

Check if user account exists.

File

photos_access/photos_access.module, line 934
Implementation of photos_access.module.

Code

function _photos_access_user($u) {
  if (isset($u['name'])) {
    $db = \Drupal::database();
    $ac = $db
      ->query("SELECT uid, name FROM {users_field_data} WHERE name = :name", [
      ':name' => $u['name'],
    ])
      ->fetchObject();
  }
  elseif (isset($u['uid'])) {
    $db = \Drupal::database();
    $ac = $db
      ->query('SELECT uid, name FROM {users_field_data} WHERE uid = :uid', [
      ':uid' => $u['uid'],
    ])
      ->fetchObject();
  }
  if (isset($ac->uid)) {
    return $ac;
  }
}