You are here

function user_relationship_service_mine in User Relationships 7

Same name and namespace in other branches
  1. 5.2 plugins/user_relationship_service/user_relationship_service.module \user_relationship_service_mine()
  2. 6 user_relationship_service/user_relationship_service.inc \user_relationship_service_mine()

Get all relationship types for the logged in user.

Return value

An array of relationship objects for the logged in user.

See also

user_relationships_load()

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

File

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

Code

function user_relationship_service_mine() {
  try {
    global $user;
    $param = array(
      'user' => $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(),
    )));
  }
}