I have a Product Display listing of indexed nodes that show a "List Price" I want to do math on them (if I can get the multipliers I can do the math) in the view to show a users "Cost" and "Selling Price" the multipliers that I need are on the users Profile however I can't seem to find a way to access the current UID/ users profile fields in this type of view.

a) is this even possible to do? b) can someone explain to me how I can do it?

Thanks in advance t anyone who can help

1 Answer 1


I am assuming you are using views module to create this listing. In that case, this is certainly possible.

But first, I am not sure what you mean by current user. Is this the user who created the particular product? Or is it the currently logged in user?

  1. If the user is the creator of the product node, just add a relationship to the user using Relationships section in the View. And then all the user profile fields will be accessible to you in the Fields section. Easy.
  2. If you're talking about the logged in user, then you can use views_php module. Install views_php and then add a PHP field to your view. In that field's output, write your php code which fetches that particular value. For example, the following code will give you the uid of the user. You can similarly extract more fields from his profile. global $user; echo $user->uid;

You can inspect this $user object using dsm(), which is provided by devel module to inspect where your field lies in this object.

One important thing, write the above code in the output section of the views_php field, and INCLUDE php tags.

  • #2 was what I needed with some modifications to get user profile fields but since this got me on the path I needed it is the best answer Oct 10, 2014 at 13:36

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.