Skip to main content
edited tags
Link
tostinni
  • 9.1k
  • 34
  • 47
edited tags
Link
tostinni
  • 9.1k
  • 34
  • 47
Source Link
ctlarsen
  • 255
  • 1
  • 3
  • 6

Within a node, how can I reference the value of a field of a node associated to the current user through a node-reference?

I'm creating a customer extranet for my client. The users are my client's customers. Within the body of a page node, I need to display the ID of the customer (company) to which the current user belongs.

Here's how I've set it up so far:

  • Drupal 7
  • I have a Customer content type that has a field called customer_id (among other things).
  • I have added a node-reference field to the User fields that references one Customer node. (In other words, each user is associated with one Customer.)

So in his profile, the current user has a node-reference value pointing to a Customer node, and I need to retrieve and display (in a page node or block) the value of one field (customer_id) in the Customer node being referenced in the current user's profile.

I've been going through several Drupal books and whatever module documentation I can find, and I've been experimenting with various views using the the Views module, but I'm still pretty stymied. Can somebody point me in the direction of a good way to implement this?

Thank you for your help!

Chris