function user_relationships_direct_create_relationship_links in User Relationships 5.2
Make links to create all outstanding relationships to a user
Parameters
$account user to create relationships to:
Return value
array of themed create links
1 call to user_relationships_direct_create_relationship_links()
- _user_relationships_get_create_relationship_links in ./
user_relationships.module - Render links to create relationship(s) with a user.
File
- plugins/
user_relationship_direct/ user_relationship_direct.module, line 79
Code
function user_relationships_direct_create_relationship_links(&$account) {
global $user;
$result = array();
$all_relationships = user_relationships_types_load();
//load relationships to this user
$existing = user_relationships_load(array(
'requester_id' => $user->uid,
'requestee_id' => $account->uid,
));
//re-key on rtid
$existing_relationships = array();
foreach ($existing as $rel) {
$existing_relationships[$rel->rtid] = $rel;
}
foreach ($all_relationships as $rtid => $relationship) {
if (isset($existing_relationships[$rtid])) {
continue;
}
$result[] = theme('user_relationships_request_relationship_link', $account, $relationship);
}
return $result;
}