function og_handler_field_user_roles::query in Organic groups 7
Same name and namespace in other branches
- 7.2 includes/views/handlers/og_handler_field_user_roles.inc \og_handler_field_user_roles::query()
Called to add the field to a query.
Overrides views_handler_field::query
File
- includes/
views/ og_handler_field_user_roles.inc, line 8
Class
- og_handler_field_user_roles
- Field handler to provide a list of group roles.
Code
function query() {
// Get a user table we can relate to.
// @todo: Make the used user relationship configurable.
foreach ($this->query->relationships as $alias => $info) {
if ($info['table'] == 'users') {
$user_table_alias = $alias;
break;
}
}
// If there is a users table present use its uid. Else, skip this field.
if (!empty($user_table_alias)) {
$this->aliases['uid'] = $this->query
->add_field($user_table_alias, 'uid');
}
parent::query();
}