function user_relationships_api_socnet_is_related in User Relationships 6
Returns TRUE if uid1 has a confirmed relationship with uid2, optionally filter by relationship name and style
Parameters
$relation_name optional name of relationship to restrict search to :
$relation_style optional, one of {'all', 'one-way', 'two-way'}:
Return value
TRUE if the relationship exists, or nothing if it does not.
File
- user_relationships_api/
user_relationships_api.socnet.inc, line 22 - 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_is_related($uid1 = NULL, $uid2 = NULL, $relation_name = NULL, $relation_style = 'all') {
$args = array(
'requester_id' => $uid1,
'requestee_id' => $uid2,
'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;
}
$count = user_relationships_load($args, array(
'count' => TRUE,
));
if ($count > 0) {
return TRUE;
}
//else return nothing
}