You are here

function user_relationship_service_user in User Relationships 7

Get all relationship types for the requested user.

Parameters

$uid: The uid of the user to look up relationships for.

Return value

An array of relationship objects for the requested user.

See also

user_relationships_load()

1 string reference to 'user_relationship_service_user'
_user_relationship_service_definition in user_relationship_service/user_relationship_service.module

File

user_relationship_service/user_relationship_service.inc, line 57
Link general user relationship functionalities to services module.

Code

function user_relationship_service_user($uid) {
  try {
    $param = array(
      'user' => $uid,
    );
    $rels = user_relationships_load($param);
    if (!$rels || !is_array($rels)) {
      throw new Exception("User relationship load failed");
    }
    return array_values($rels);
  } catch (Exception $ex) {
    return services_error(t('Error getting user relationships: @msg', array(
      '@msg' => $ex
        ->getMessage(),
    )));
  }
}