1

I've been trying to create a view of all users, showing their relationship to the current one. I can't figure out a way to display all of them. By adding the Contextual filters User UID or Requester user, the views results are restricted only to users having a relationship (with the current one), therefore not showing the ones not having one...

I have also been trying to use the Relationship "Requester user is current user", but without success.

Here an example of the expected result: https://i.sstatic.net/kifyJ.png

Am I missing something? thanks in advance for your help

2 Answers 2

0

A contextual filter does not limit the results, it only adds additional input to the view based on certain situations.

It may be a problem with the relationship.

Please check that Require this relationship is not ticked. If it is then by its description "Enable to hide items that do not contain this relationship".

If you just add the relationship but not require it, a field taken from the relationship will only display as a blank space in your rendered view.

Hope this helps. I had the same problem before.


Update 2014/06/20

I'm assuming the view displays users.

Contextual Filters

  • add User:Uid -- When the filter value is NOT in the url, provide a default value -- User ID from logged in user.

This filter will set it to display based on the current user.

Relationships

  • User relationships: Requester user -> use the contextual filter on this

You'll have to play around with this as I'm not sure.

Sort Criteria

  • UID ascending

Fields

  • UID: (this will display all the user IDs) (check first after adding this that ALL users are displayed.)
  • Relationship Type
  • UID: (use the relationship)

Try adding the first field first then adding all the contextual filter, relationship stuff. It has to display ALL the users.

9
  • Thanks Japo for answer. Indeed it might be an issue with a Views relationship, but still can't figure out how to get the expected results. None of them have Require this relationship ticked. I can pretty easily get all the user-relationships that the current user has (and with whom) but still struggling to show all other users (basically with a blank field in the user-relationship column)...
    – Ned
    Commented Jun 17, 2014 at 13:15
  • If you remove both the contextual filter and the relationship, do all users display? Try adding them in one at a time to find the problem but start adding the relationships first. Commented Jun 18, 2014 at 8:16
  • Yes exactly what I have tried... Basically now I can have a view of all users's id with their relationship with other users, but when I add the contextual filter it filters down to the current user relations' only :S i.imgur.com/qKxqObX.png i.imgur.com/g5dqP8i.png
    – Ned
    Commented Jun 18, 2014 at 14:53
  • Please explain what's showing in the photo. :) Commented Jun 18, 2014 at 23:17
  • Sure! So basically the first screenshot shows the settings of my view. The second one shows the results. You can see in this table view that the first column shows the ID of each user, second column shows the relationship this user has with another user ID, in column three. I'm getting close with this view to what I need, but it needs to be filtered down with some kind of contextual filter (current user I guess), so that it displays only one time each user, and the relationship (colleague or nothing/blank) with the current user... thanks again for your help, much appreciated
    – Ned
    Commented Jun 19, 2014 at 7:00
0

Here is the way to have a list of users relationships in this screen capture

Just in RELATIONSHIPS edit : User relatinoship:Requestee user

add

When the filter value is not in the url > provide default value > user ID from logged in user

idem for CONTEXTUAL FILTERS and selected you relationship by the name you gave it.

After you can do more wih add a path for your page like user/%/mypagename and add to user menu tab

enter image description here

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.