Is there a way to pull a field from the profile of the user who's viewing the node (always registered in my case) and compute it with a field from that specific node?

Comments

asak’s picture

Answering myself: This probably isn't possible. from what i (now) understand the computation of fields is done on creation/update, and not when the node is actually viewed. It probably is possible to use data from the author's profile, but not from the viewer's profile.

Rosamunda’s picture

It probably is possible to use data from the author's profile...

How could that be done? With Views?

sin’s picture

Current computed field module has a bug -- field is calculated only on node save/update and not on every node view as advertised. This bug can be fixed with patch at #134661: Recompute on every display not working?. After applying this patch I use current user profile values with the following code:

// Load corrent user profile.
if (function_exists('profile_load_profile')) {
  global $user;
  profile_load_profile($user);
  if (!empty($user->profile_field_1)) {
    ... use $user->profile_field_1
  }
}
colan’s picture

Component: Miscellaneous » Code
Status: Active » Closed (won't fix)

Version 5 is no longer supported.