You are here

function DefaultController::_username_check_is_user_exists in Username originality AJAX check 8

Query user table to check if such username is already exists.

2 calls to DefaultController::_username_check_is_user_exists()
DefaultController::username_check_callback in src/Controller/DefaultController.php
DefaultController::username_check_profile_callback in src/Controller/DefaultController.php

File

src/Controller/DefaultController.php, line 58
Contains \Drupal\username_check\Controller\DefaultController.

Class

DefaultController
Default controller for the username_check module.

Namespace

Drupal\username_check\Controller

Code

function _username_check_is_user_exists($username) {
  return db_query("SELECT COUNT(u.name) count FROM {users_field_data} u WHERE LOWER(u.name) = LOWER(:username)", array(
    ':username' => $username,
  ))
    ->fetchField();
}