Hi,

I am new to Druapl an try to set up some thing.

Right now I got a problem, when I use in CCK the node reference field, a user can choose from all content of this content type. Is there a way, that the user only see his own content. For example, all his blog entries instead of all existing blog entries from all users!

Hope my english is not that bad, that you can understand what I am trying to describe ;)

Regards,

Tobi

Comments

CloudCuckoo’s picture

If you have the views module installed you can create a view to list the nodes available to be referenced. In the Advanced settings for the node reference field choose that view to get the list of possible references. (This field only shows up if you have views installed.)

ressa’s picture

Create a new View, call it for example "reference_own_nodes". Add a new argument (click the Plus sign next to 'Arguments') and select 'Node: User posted or commented'.

Under 'Action to take if argument is not present:', select 'Provide default argument' and under 'Default argument type:' select 'User ID from logged in user'.

Next, go to the content type with the node reference field and under 'Advanced - Nodes that can be referenced (View) - View used to select the nodes:' select your new View "reference_own_nodes" and save it. Users should now only be able to reference nodes they created themselves.

parasox’s picture

Thank you very much Ressa, this should make it into a documentation page if it's not already. Solved my problem thank you.

Sentrashy’s picture

This is good decision, but what if i want to give a opportunity to an author to chose while he creating a node can other people make refereced nodes or not?

d0t15t’s picture

hi Ressa,

is there a solution like this for drupal 7? i can't find anything...
thanks,

dotist

ressa’s picture

Hi dotist,
They are working on a solution, with the References module: http://drupal.org/node/945004
Perhaps you can test drive the latest dev version? It might work by now.

d0t15t’s picture

thanks - ja it looks like they are close...

ressa’s picture

@dotist
I just checked the thread mentioned above, and the References module has been patched by yched. I tried the latest release (7.x-2.0-beta3 + latest View dev. version) and managed to somehow save the view as a Reference, though the text was overlapping in the Views UI... probably a bug in Views latest Dev version. But proof of concept: it is now possible!

d0t15t’s picture

@ressa,
yes i've got it working as well! happy daze...