I have user profiles enabled on my site (using nodefamily) and I want to be able to add links on user profile pages that will give information about the owner of that particular page say user/5/photos for all the user's photos. I obviously can't add the number, but can't just put "user" either, since that will display information about me or whoever the user is that clicks on the link.

So, how can I do this?

Any help will be appreciated.

Comments

dan33’s picture

You can override the default profile theme if you like, and add the extra links using the user's information.

In user.module, line 647 you'll find function theme_user_profile($account, $fields). Copy the function and alter it accordingly in your theme's template.php file.

Hope that helps.

zahor’s picture

This is the code, I don't understand how I would edit it to display a link I would like. I don't want to add a field, I know how to do that (since the profile is custom, I added most fields). I want to create maybe a menu link (or link on the profile) that takes visitor to user's albums or something like that.

function theme_user_profile($account, $fields) {
  $output = '<div class="profile">';
  $output .= theme('user_picture', $account);
  foreach ($fields as $category => $items) {
    if (strlen($category) > 0) {
      $output .= '<h2 class="title">'. $category .'</h2>';
    }
    $output .= '<dl>';
    foreach ($items as $item) {
      if (isset($item['title'])) {
        $output .= '<dt class="'. $item['class'] .'">'. $item['title'] .'</dt>';
      }
      $output .= '<dd class="'. $item['class'] .'">'. $item['value'] .'</dd>';
    }
    $output .= '</dl>';
  }
  $output .= '</div>';

  return $output;
}