You are here

function _username_check_is_current_user in Username originality AJAX check 8

Same name and namespace in other branches
  1. 7 username_check.unique.inc \_username_check_is_current_user()

Query user table to check if this is the current user.

1 call to _username_check_is_current_user()
username_check_profile_callback in ./username_check.unique.inc
Main AJAX function: originality check menu callback for user profile

File

./username_check.unique.inc, line 100
AJAX callbacks for the username_check module.

Code

function _username_check_is_current_user($username) {
  $user = \Drupal::currentUser();
  return db_query("SELECT COUNT(u.name) count FROM {users} u WHERE LOWER(u.name) = LOWER(:username) AND u.uid =" . $user->uid, array(
    ':username' => $username,
  ))
    ->fetchField();
}