function user_relationships_api_socnet_get_related_users in User Relationships 6
return a list of uids of established relationships of $uid, optionally filter by relationship name
File
- user_relationships_api/
user_relationships_api.socnet.inc, line 75 - User Relationships implementation of http://drupal.org/project/drupal_universal_relation_api @author Alex Karshakevich http://drupal.org/user/183217
Code
function user_relationships_api_socnet_get_related_users($uid = NULL, $relation_name = NULL, $relation_style = 'all') {
$args = array(
'requester_id' => $uid,
'approved' => 1,
);
//optinally filter on relationship name
if ($relation_name) {
$args['name'] = $relation_name;
}
//or, filter on relationship directionality
if ($relation_style == 'one-way') {
$args['is_oneway'] = TRUE;
}
elseif ($relation_style == 'two-way') {
$args['is_oneway'] = FALSE;
}
$result = user_relationships_load($args, array(
'sort' => 'requestee_id',
));
if ($result > 0) {
return array_keys($result);
}
//else return nothing
}