Determining current user's relationship to node author I'm currently using User relationships module, and setting the UR-Node access module so that nodes can only be viewed by users related to the author.

However, I want to have a public display version of the node for search engines, sharing links, and also for a button to say 'You need to become friends with x to see this node'. 

So, I was thinking of using the User relationships API to determine the users' relationship, and output two different displays in the tpl.php file. 

Does anybody know how to determine the relationship programatically? I'm stuck. 

(I've done this in the Views I've made, it's just in the nodes, that I'm having trouble)
It looks like you can use the user_relationships_load() function. The following code will load all relationship objects that exist in the system between 2 users. From there you can inspect the relationships for their type/properties and make your decision based on that:

// Set up the user ids
global $user;
$current_user_uid = $user-&gt;uid;
$node_author_uid = $node-&gt;uid;

// Set up the parameters
$params = array('between' =&gt; array($current_user_uid, $node_author_uid));

// Get the relationships
$relationships = user_relationships_load($params);