function userreference_autocomplete_value in Content Construction Kit (CCK) 6.3
Same name and namespace in other branches
- 6 modules/userreference/userreference.module \userreference_autocomplete_value()
- 6.2 modules/userreference/userreference.module \userreference_autocomplete_value()
Value for a userreference autocomplete element.
Substitute in the user name for the uid.
1 string reference to 'userreference_autocomplete_value'
- userreference_widget in modules/
userreference/ userreference.module - Implementation of hook_widget().
File
- modules/
userreference/ userreference.module, line 455 - Defines a field type for referencing a user from a node.
Code
function userreference_autocomplete_value($element, $edit = FALSE) {
$field_key = $element['#columns'][0];
if (!empty($element['#default_value'][$field_key])) {
$value = db_result(db_query("SELECT name FROM {users} WHERE uid = '%d'", $element['#default_value'][$field_key]));
return array(
$field_key => $value,
);
}
return array(
$field_key => NULL,
);
}