Download & Extend

Restrict node access via a template file

Project:User Relationships
Version:6.x-1.0-beta2
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:alex.k
Status:closed (fixed)

Issue Summary

Can someone give me a pointer on what code I might use in a content template to restrict access to a node based on the relationship one has with the node's author? I just need a hint on the logic/variables I would use to, say, restrict access to a given text field based on their "client" relationship status.

Comments

#1

You can look at the user_relationships_load() function. Check the docs for it, as it can run a number of different queries. In your case I'd do something like

<?php
user_relationships_load
(array("between" => array($uid1, $uid2)))
?>

You would iterate over all returned relationships, checking if the desired one is present.

or, try this for more precision:

<?php
user_relationships_load
(array("between" => array($uid1, $uid2), "rtid" => $client_relation_type_id))
?>

#2

Assigned to:Anonymous» alex.k
Status:active» fixed

Cleaning up the issue queue.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here