function user_relationship_views_views_tables in User Relationships 5.2
views_tables_hook()
File
- plugins/
user_relationship_views/ user_relationship_views.module, line 6
Code
function user_relationship_views_views_tables() {
$tables['user_relationships_users'] = array(
'name' => 'users',
'join' => array(
'left' => array(
'table' => 'user_relationships',
'field' => 'requester_id',
),
'right' => array(
'field' => 'uid',
),
),
);
$tables['user_relationships'] = array(
'name' => 'user_relationships',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'uid',
),
'right' => array(
'field' => 'requestee_id',
),
),
'fields' => array(
'author_relationships_to_current_user' => array(
'name' => t("User Relationships: Author's Relationships to Current User"),
'handler' => 'user_relationship_views_relationships_field_handler',
'option' => array(
'#type' => 'select',
'#options' => array(
'any' => t('Any'),
1 => t('Only Approved'),
0 => t('Only Non-Approved'),
),
),
'order' => array(
'requestee_id',
'requester_id',
),
'notafield' => TRUE,
'help' => t('This will display the relationships between the author and the current user.'),
),
'current_user_relationships_to_author' => array(
'name' => t("User Relationships: Current User's Relationships to Author"),
'handler' => 'user_relationship_views_relationships_field_handler',
'option' => array(
'#type' => 'select',
'#options' => array(
'any' => t('Any'),
1 => t('Only Approved'),
0 => t('Only Non-Approved'),
),
),
'order' => array(
'requester_id',
'requestee_id',
),
'notafield' => TRUE,
'help' => t('This will display the relationships between the current user and the author.'),
),
'number_relationships_of_author' => array(
'name' => t("User Relationships: Number of Relationships held by Particular User"),
'handler' => 'user_relationship_views_number_relationships_field_handler',
'option' => array(
'#type' => 'select',
'#options' => array(
'user' => t('Any'),
'requester_id' => t('User is Requestee'),
'requestee_id' => t('User is Requester'),
),
),
'notafield' => TRUE,
'help' => t('This will display the total number of relationships held by a particular user.'),
),
'approved' => array(
'name' => t('User Relationships: Approval Status'),
'handler' => 'user_relationship_views_approved_field_handler',
'sortable' => TRUE,
'help' => t("Display the approval state of the relationship (really only useful if you've filtered by a relationship)."),
),
'created_at' => array(
'name' => t('User Relationships: Relationship Creation Date'),
'handler' => views_handler_field_dates(),
'sortable' => TRUE,
'help' => t("Display the date the relationship was created (really only useful if you've filtered by a relationship)."),
),
),
'filters' => array(
'username_rtid' => array(
'field' => 'rtid',
'name' => t("User Relationships: Author's relationship with Username"),
'help' => t('Allows you to filter by how the author relates to the user (provided in "options").'),
'handler' => 'user_relationship_views_username_rtid_filter_handler',
'operator' => 'user_relationship_views_handler_operator_eqneq',
'value' => array(
'#type' => 'select',
'#options' => 'user_relationship_views_relationship_types',
),
'option' => array(
'#type' => 'textfield',
'#size' => 20,
'#autocomplete_path' => 'user/autocomplete',
),
),
'current_user_rtid' => array(
'field' => 'rtid',
'name' => t("User Relationships: Author's relationship with the Current User"),
'help' => t("Allows you to filter by the author's relationship to the currently logged in user."),
'handler' => 'user_relationship_views_current_user_rtid_filter_handler',
'operator' => 'user_relationship_views_handler_operator_eqneq',
'value' => array(
'#type' => 'select',
'#options' => 'user_relationship_views_relationship_types',
),
'cacheable' => 'no',
),
),
);
return $tables;
}