You are here

function _pmperson_migrate_check_if_username_exists in Drupal PM (Project Management) 7.2

Same name and namespace in other branches
  1. 8 pmperson/includes/pmperson.migrate.inc \_pmperson_migrate_check_if_username_exists()
  2. 7.3 pmperson/includes/pmperson.migrate.inc \_pmperson_migrate_check_if_username_exists()

Checks whether a given username exists.

1 call to _pmperson_migrate_check_if_username_exists()
_pmperson_migrate_generate_unique_username in pmperson/includes/pmperson.migrate.inc
A custom function to generate unique username.

File

pmperson/includes/pmperson.migrate.inc, line 504
Migration functions for the PM Person module.

Code

function _pmperson_migrate_check_if_username_exists($username) {
  $result = db_query('SELECT u.uid FROM {users} u WHERE name = :name', array(
    ':name' => $username,
  ));
  if ($result) {
    foreach ($result as $r) {
      return TRUE;
    }
  }
  return FALSE;
}