function user_relationship_service_request in User Relationships 6
Same name and namespace in other branches
- 5.2 plugins/user_relationship_service/user_relationship_service.module \user_relationship_service_request()
- 7 user_relationship_service/user_relationship_service.inc \user_relationship_service_request()
1 string reference to 'user_relationship_service_request'
- user_relationship_service_service in user_relationship_service/
user_relationship_service.module - Implementation of hook_service().
File
- user_relationship_service/
user_relationship_service.inc, line 65 - @author Drupal 6 port by Darren Ferguson <http://drupal.org/user/70179> @author Written by scottgifford http://drupal.org/user/245699 Link general user relationship functionalities to services module.
Code
function user_relationship_service_request($version, $uid, $type_name) {
try {
$type = user_relationships_type_load(array(
'name' => $type_name,
));
error_log("Relationship request with '{$uid}' type '{$type_name}'");
if (!$type) {
throw new Exception(t('No such relationship type'));
}
global $user;
$ret = user_relationships_request_relationship($user, $uid, $type);
if (!$ret) {
throw new Exception(t('Unknown failure'));
}
else {
if (!is_object($ret)) {
throw new Exception($ret);
}
}
return $ret;
} catch (Exception $ex) {
return services_error(t('Error requesting relationship: @msg', array(
'@msg' => $ex
->getMessage(),
)));
}
}