Hi everybody! I would like to know if it is possible to get the following behavior by using the Node Relativity / Node Relativity Access Control modules.

I have a node of type A that links to other nodes of type B. Besides, I'm using Views to restrict drupal users access just to those nodes they have created (filtering Views by user, and using the module Private)

But when some user creates a node of type A, and is offered to link this node with a node of type B, a complete links of all the B nodes in the database is displayed, no matter the user being the creator of such nodes.

I need to restrict the list of possible nodes to link with, just to those nodes belonging to the current user.

I've explored the options offered by these modules, but I didn't find a way to make it.

Any ideas? Thanks a lot!

Jorge Luis

Comments

jlalvarezmedina’s picture

I'm trying to customize the function relativity_list_possible_children inside the module. I think that I could make it happen by adding the userID to the WHERE clause in the db_query that is executed. I mean, changing

db_query('SELECT n.nid FROM {node} n WHERE n.type = \'%s\' AND n.status = 1 AND ORDER BY n.title', $type);

for something like

db_query('SELECT n.nid FROM {node} n WHERE n.type = \'%s\' AND n.status = 1 AND n.uid = \'%d\' ORDER BY n.title', $type, $user->uid);

But, as I don't know much about Drupal's internals, I don't know from where to get the user ID to compare.

Any help will be appreciated.

jlalvarezmedina’s picture

that's it. I did it. Sorry for bothering.

Just in case someone else needs it, what I did was it: I modified the relativity.module relativity_list_possible_children function to do the following db_query

global $user; //needs to be declared
db_query('SELECT n.nid FROM {node} n WHERE n.type = \'%s\' AND n.status = 1 AND n.uid = \'%d\' ORDER BY n.title', $type, $user->uid);

and that's it. The list of possible nodes is restricted just to those that were created by the currently logged user :)