I'm having a bit of difficulty creating a view to show me a user's manager.

The user entity has a User Reference field, called Manager. This is populated with, well, the user's manager (through an autocomplete widget, if it matters).

I'm trying write a view that will output the user's manager name.

The view I have outputs the field User:Name

The relationship is User:Manager

The contextual filter is giving me a problem. If I leave this blank, I get the current user, and his manager. If I set this to just about anything that makes sense (User: UID, for example), there's no output.

Ultimately, a visitor to the site may be viewing a user's profile, with a link to the user's manager's profile.

Edit: I assume I need to use a contextual filter, as this will end up on a user's profile view, as part of a panel.

The field is a "User Reference" - http://drupal.org/project/references

Ideally, I would like to be able to do the reverse as well. If I look at a manager's profile, it would list his/her subordinates.


Thanks ..

  • I'm not clear on how contextual filters fit into this. Are you wanting to list all users with their associated managers on the same "row", or do you want to pass in a user's UID and have the view output just that one user's manager? And what kind of field is this? Is it an entityreference field?
    – Aaron
    Aug 5, 2015 at 21:23
  • What @Aaron says. What is contextual filter for? Why would you need it? What is it's reason? If you really want to filter by context, you shouldn't need to set it up manually to anything. And if you want to filter manually, you need exposed filters, but not contextual ones. So what's it about?
    – Mołot
    Aug 5, 2015 at 21:25
  • I assumed I needed contextual filters, based on some Drupal 6 -> 7 conversion information I'd read. In the end, I want to plug this into a panel, so when a user is shown, a link to his/her manager is shown as well
    – Tim
    Aug 5, 2015 at 21:27
  • 1
    No need for views, then. Assuming your Panel page has access to a node context (which it will if you're using it the node/%node task) then Panels will let you simply render the value of an individual field.
    – Aaron
    Aug 5, 2015 at 21:30
  • @Aaron I agree that it seems Views isn't needed here. But you probably mean user context, not node context? Aug 6, 2015 at 4:27


Your Answer

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

Browse other questions tagged or ask your own question.