function DefaultController::_username_check_is_current_user in Username originality AJAX check 8
Query user table to check if this is the current user.
1 call to DefaultController::_username_check_is_current_user()
- DefaultController::username_check_profile_callback in src/
Controller/ DefaultController.php
File
- src/
Controller/ DefaultController.php, line 110 - Contains \Drupal\username_check\Controller\DefaultController.
Class
- DefaultController
- Default controller for the username_check module.
Namespace
Drupal\username_check\ControllerCode
function _username_check_is_current_user($username) {
$account = \Drupal::currentUser();
return db_query("SELECT COUNT(u.name) count FROM {users_field_data} u WHERE LOWER(u.name) = LOWER(:username) AND u.uid =" . $account
->id(), array(
':username' => $username,
))
->fetchField();
}