function getlocations_get_uid_from_lid in Get Locations 7
Same name and namespace in other branches
- 6.2 getlocations.module \getlocations_get_uid_from_lid()
- 6 getlocations.module \getlocations_get_uid_from_lid()
- 7.2 getlocations.module \getlocations_get_uid_from_lid()
Function to get uid from getlocations_fields_entities or location_instance table.
Parameters
int $lid:
Return value
Returns uid.
1 call to getlocations_get_uid_from_lid()
File
- ./
getlocations.module, line 1794 - getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_get_uid_from_lid($lid) {
if (is_numeric($lid) && $lid) {
$query = FALSE;
if (module_exists('getlocations_fields')) {
$query = db_select('getlocations_fields_entities', 'i')
->fields('i', array(
'uid',
))
->condition('i.glid', $lid);
}
elseif (module_exists('location') && module_exists('location_user')) {
$query = db_select('location_instance', 'i')
->fields('i', array(
'uid',
))
->condition('i.lid', $lid);
}
if ($query) {
$row = $query
->execute()
->fetchAssoc();
return isset($row['uid']) && $row['uid'] ? $row['uid'] : FALSE;
}
}
return FALSE;
}