I'm working on (like so many other people, it seems) a complex user profile page. In the end, I would like to be able to have 3 different types of profiles, so I've gone through Michelle's tutorial. From what I've read in http://drupal.org/node/116578 the Views module is pretty heavy on cpu/db load when run pretty frequently. Because of that, I decided to try to go around the Views module and write a custom page-user.tpl.php file to handle the display. I also like this route, because it lets me specify exactly how the html coming out of it will look, so I can provide the the users some clean css to edit.

The problem I'm running into, is that I cannot figure out how to get the NodeProfile information from the usernode into the user object so that I can access the fields within the template file. A suggestion from http://groups.drupal.org/node/4200 mentioned writing a CCK widget that incorporated the two, but I'm pretty new to Drupal, and my PHP is only passable at most.

Can someone shine some more light on this?

Thanks!

Comments

jmcoder’s picture

change the function nodeprofile_load to:

function nodeprofile_load($type, $uid) {
global $cachenodeprofile;
  static $cache = array();

  if (!isset($cache[$type][$uid])) {
    $cache[$type][$uid] = node_load(array('type' => $type, 'uid' => $uid));
  }
$cachenodeprofile[$type][$uid] = $cache[$type][$uid];
  return $cache[$type][$uid];
}

and in your template, at the top,

global($cachenodeprofile);