You are here

function casetracker_get_uid in Case Tracker 7

Same name and namespace in other branches
  1. 5 casetracker.module \casetracker_get_uid()
  2. 6 casetracker.module \casetracker_get_uid()

Given a user name, returns the uid of that account. If the passed name is not found, returns 0. See also casetracker_get_name().

6 calls to casetracker_get_uid()
casetracker_comment_insert in ./casetracker.module
Implements hook_comment_insert().
casetracker_comment_update in ./casetracker.module
Implements hook_comment_update().
casetracker_comment_view in ./casetracker.module
Implements hook_comment_view().
casetracker_default_assign_to_validate in ./casetracker_admin.inc
Element validate for the default assign to value.
casetracker_node_insert in ./casetracker.module
Implements hook_node_insert().

... See full list

File

./casetracker.module, line 1315
Enables the handling of projects and their cases.

Code

function casetracker_get_uid($name = NULL, $reset = FALSE) {
  static $users = array();
  if (!isset($users[$name]) || $reset) {
    $result = db_select('users', 'u')
      ->fields('u', array(
      'uid',
    ))
      ->condition('u.name', $name)
      ->execute()
      ->fetchField();
    $users[$name] = $result ? $result : 0;
  }
  return $users[$name];
}