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
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

alex.k - September 28, 2008 - 18:26

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

alex.k - July 6, 2009 - 20:47
Assigned to:Anonymous» alex.k
Status:active» fixed

Cleaning up the issue queue.

#3

System Message - July 20, 2009 - 20:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.