6

I have played with a bunch of modules (Node Reference Node Access, Views Field, View Reference) and can't seem to find one that does a very simple job; In one content type I want a field that provides a select list of all nodes owned by current user from another content type.

Think of it (roughly) as blog content types.

  • Blog 1 - Owned by user 1
  • Blog 2 - Owned by user 2
  • Blog 3 - Owned by user 1

In another content type (updates) we'll have a field that is used for building a relationship (ie, select the blog that this update will be related to) and that field should be populated with the blogs owned by that user;

  • Select Blog (for user 1 the list would contain;
    • Blog 1
    • Blog 3

I have read so much, installed so many modules and I just cant get it to work. The closest I have got is a field that contained the name of the view, which is not overly helpful.

EDIT: Screen Shots: Manage Fields Top section of Field edit Bottom section of Field edit

3 Answers 3

4
+100

I managed to get this working in Drupal 7.

  1. Install the very latest development snapshot of Views 3.
  2. Install the very latest development snapshot of Chaos tools suite.
  3. Install References beta-3.
  4. Enable the Views UI module and the Node References module that comes with References.
  5. Create a new view.
  6. Add a 'References' display to that view - note, this is a special Views display type that you get from installing the References module - it is not a Page or Block display.
  7. Add a Node reference field to your content type. You will now be able to select the Views display that you created in step 6 to filter the list of nodes that can be referenced. You do this in the 'VIEWS - NODES THAT CAN BE REFERENCED' fieldset. enter image description here
3
  • obviously be careful about relying on dev snapshots!
    – Andy
    Commented May 16, 2011 at 8:27
  • Yes. I didn't actually test this with the latest 'stable' versions, so it may be worth trying with those too. Commented May 16, 2011 at 9:14
  • Thanks Tom! Still getting 'broken/missing handler' errors when adding filters though... Any ideas?
    – Christian
    Commented May 17, 2011 at 11:22
5

If I understand you right, you can use a View as the source for the nodereference widget, and give it appropriate filters to only show nodes of a certain type authored by the current user. To use a view (assuming you have Views installed and appropriate perms) you can

  • edit the nodereference by going to Content management -> Content types -> Edit [whatever content type] -> Manage fields -> [whatever field name];
  • in the fieldset Global settings click to expand the fieldset Advanced - Nodes that can be referenced (View);
  • select the appropriate view in View used to select the nodes;
  • if you want to use arguments you can specify them in View arguments.
10
  • No, thats exactly right, but I could not see where in the Nodereference widget to specify a View as the source.
    – Christian
    Commented May 4, 2011 at 0:03
  • 1
    @Christian, are you ok now, or would you like some more details?
    – Andy
    Commented May 4, 2011 at 8:23
  • 1
    @Christian I've updated the answer - post back here if there are still troubles!
    – Andy
    Commented May 9, 2011 at 17:34
  • 1
    @Christian no worries, take a look at my additional info in the answer - if that doesn't help, could you add a screenshot of the screen you get?
    – Andy
    Commented May 10, 2011 at 12:21
  • 1
    @Christian - looks like you've got an answer! report back if it still doesn't work.
    – Andy
    Commented May 11, 2011 at 14:05
2

For D7 you will need to use the references module, this allows you to filter by a view much in the way that Andy has described in his question.

note: beta-2 which should have the code in has only just come out (may 7th) so even if you tried it before it is worth downloading again.

2
  • I think I may have hit a bug with views 3, I keep getting 'Broken/missing handler' messages instead of the filters I am adding ...
    – Christian
    Commented May 15, 2011 at 10:39
  • You may find some of your modules need upgrading to work with views 3 Commented May 16, 2011 at 8:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.