I need a way to associate one or more users to a node.

eg. I create a node which is called MyLittleProject and I know that 5 of my current registered users are working on this project. How can I associate them to the node so I can see in the page something like "...and the people involved in this project: user1, user2, user3"

I can put the link to the users manually, but I want to associate them in a better and more consistent way.
Any module do the trick?
Any ideas?

Thank you in advance for your help!


puleddu’s picture

Would be great if in a dual behavior, when I browse to the user profile, I find there the list of the project he's working on.
Thank you!


jmesam’s picture


RichCarrillo’s picture

I'm pretty new to Drupal, so I hope I put you on the right path.

It looks like this can be done with CCK (content module) and Views. (I'm starting to think that anything can be done with these two modules)
I was able to mock it up on a local install by doing the following...

Create the MyLittleProject content type
1) Add a user-reference field to it. I named it "contributors"
2) Use the "select list" widget and check the "multiple values" box

Now, when you create a MyLittleProject, you will be able to select users from a list.
These users will be displayed as a list when the node is viewed (you can further control how this is presented with the Contemplate module). The names on the list will be links, back to the user's page.

For the reverse reference (listing projects on a user's page) you can use Views. I set it up so that "Projects" is a tab on the user page, which lists the MyLittleProject nodes that have this user in the user-reference field.

Create a View. I named it 'Projects'
check "provide a page view"
url - user/$arg/projects
display - table
check "provide a menu"
check "provide menu as tab"
name the menu

Under fields, add whatever you want to be displayed as the project list. I used "Node Title" and "Node Created Time"
Under arguments, choose "User Reference: Contributors" (CCK exposes all it's fields to Views)
Save the view

Now on each user's page, there should be a new tab call "Projects" which will list the nodes which have that user specified in the "Contributors" field.

Hope this helps.

puleddu’s picture

I was coming back to give the news I found the solution, but you had the idea quite earlier.
Thank you man, you rock!


mshaver’s picture

I thought this was possible form construction views in the past, but these options have disappeared for me? I'm wondering if there is some conflict with another module? Or maybe I just have it set up wrong?

drupalmind’s picture

What if i want that node only accessible by the user i have selected from reference field. other users can't see the node.
any idea about node will only be accessible to user selected from node reference filed during node creation.