function casetracker_get_name in Case Tracker 7
Same name and namespace in other branches
- 5 casetracker.module \casetracker_get_name()
- 6 casetracker.module \casetracker_get_name()
Given a uid, returns the name of that account. If the passed uid is not found, returns the default "assign to" name as specified in the settings. @todo This may not always be desired, but is how we use it. See also casetracker_get_uid().
4 calls to casetracker_get_name()
- casetracker_case_form_common in ./
casetracker.module - Common form elements for cases, generic enough for use either in a full node display, or in comment displays and updating. Default values are calculated based on an existing $form['nid']['#value'].
- casetracker_views_handler_field_user_name::render in includes/
casetracker_views_handler_field_user_name.inc - Render the field.
- theme_casetracker_comment_changes in ./
casetracker.module - Displays the changes a comment has made to the case fields.
- _casetracker_actions_update_by_comment in casetracker_actions/
casetracker_actions.module - Update case by programmatically inserting a comment posted by current user.
File
- ./
casetracker.module, line 1334 - Enables the handling of projects and their cases.
Code
function casetracker_get_name($uid = NULL, $reset = FALSE) {
static $users = array();
if (!isset($users[$uid]) || $reset) {
if ($uid == 0) {
$users[0] = t('Unassigned');
}
else {
$result = db_select('users', 'u')
->fields('u', array(
'name',
))
->condition('u.uid', $uid)
->execute()
->fetchField();
$users[$uid] = $result ? $result : '';
}
}
return !empty($users[$uid]) ? $users[$uid] : casetracker_default_assign_to();
}