I've content type with a user_reference field associated, named: field_responsible_id

trying to access prgramatically to the user data (associated through the user_reference field), from a custom view, I have:

$node->field_responsible_id['en'][0]['uid']

so, I'm getting the user name by : $userName = user_load( $node->field_responsible_id['en'][0]['uid'] )->name

I'm wondering if is there a better way to accomplish this ?

thank you in advance

Comments

sanguis’s picture

Status: Fixed » Active

You can do this by making that User Reference field a Relationship with in the view, then you add the rest of the user data as a field

karens’s picture

Status: Active » Fixed

Answered above.

Status: Active » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gusantor’s picture

hello, thak you both for this info