Restrict node access via a template file
daneyuleb - September 24, 2008 - 03:17
| Project: | User Relationships |
| Version: | 6.x-1.0-beta2 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | alex.k |
| Status: | closed |
Jump to:
Description
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.

#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
<?phpuser_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:
<?phpuser_relationships_load(array("between" => array($uid1, $uid2), "rtid" => $client_relation_type_id))
?>
#2
Cleaning up the issue queue.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.