1

I'm working on a site where members can have three different roles. Gold, Silver and Bronze.

Now I'm trying to set up a view that will display the: last three nodes of all Gold members and last two nodes of all Silver members and the last node of all Bronze members,

I want all these nodes displayed together on the homepage, randomly ordered. And I just can't figure out how to do this.

I can make a view that shows all last nodes of all users. And I tried working this out with "views field view" making different views showing nodes per user and combining these views in one view but then I am not able to randomly order them.

Well I hope someone can help me out here. Thanks in advance

2 Answers 2

1

Create a fresh (block) view that displays all nodes. Then you can add a relationship to Content: Author.

After adding the relationship, you will be able to add a new filter for User: Roles that uses the Author relationship. Set this filter to your Gold member role. Set the view to display 3 items.

Add a new Attachment display: enter image description here

Under attachment settings, attach it to your first views display (the gold member display). Attachment position should be "After". Set the User: Roles filter to show Silver members and set the "Items to display" to 2 items.

Add another Attachment view and repeat the last steps, setting the User: Role to Bronze and changing the Items to display to 1.

Now when you view the block, it will show 3 gold, 2 silver and 1 bronze node.

5
  • Hi Patrick, thanks for your post and reminding me of the Attachment function of views. But this won't work like I want. Because this only works when I have one member of each role. When I for instance have two gold members, I want the last three nodes of each gold member is shown.
    – Joost
    Mar 9, 2015 at 9:37
  • This does not limit anything to a specific user, it will show 3 gold, 2 silver, 1 bronze pulled from all users. The only way it would be limited to a specific user is if you add a filter for a specific user. Mar 9, 2015 at 17:24
  • Was your intention to show more than the 3,2,1? For example if you have 10 gold members, do you want to show 30 gold member's posts? Mar 9, 2015 at 17:28
  • Yes! That's what I want.
    – Joost
    Mar 9, 2015 at 18:21
  • Hi Patrick, I got this thing figured out (almost) using the Attachment was the key I think, I can output what I want, but now I have a ordering issue. Using the attachment I can choose to place it before or after the content. This way it's not possible to scramble all nodes. What I want is that the output of the page and both attachments are combined and can be scrambled and ordered randomly. Is this possible?
    – Joost
    Mar 10, 2015 at 12:02
0

Okay, I finally solved it. What I basically wanted but wasn't able to find the right words for is to merge content of two views. Basically it's not necessary to have two views. It's possible to use one filter with AND/OR logic use of the filter option. All is explained in this wonderfull post:

http://www.webomelette.com/drupal-views-filters-and-or-logic

Thanks for thinking with me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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