How hard would it be to add menu trails for user pages so they could go under a "people" tab, but if you are looking at your own user page, it would go under "My account". Right now, all of our user pages are showing up under "my account", which is a primary menu item we have. I assume this is because /user/[uid] seems like a child of /user to drupal by default?

Comments

frankcarey’s picture

does this make sense?

alexgreyhead’s picture

Seconded - it would be a great help to be able to show the link to /user as "active" when the current page path is /user/[uid]/foo/bar etc :o)

oskarblue’s picture

Subscribe :)

fuerst’s picture

Just a hint, don't have time to look further at that time: May be this can be done by implementing hook_user() in menutrails.module like this:

function menutrails_user($op, &$edit, &$account) {
  // Only interested in the user view op
  if ('view' != $op) {
    return;
  }

  // Do user-related stuff necessary for setting menu trail/breadcrumb here
}
jgreep’s picture

Issue tags: +user

I've got the following to work for the user view and for the user edit.

function menutrails_user_location() {
  // This should only fire if the menu isn't already active.
  $item = menu_get_item();
  if (db_result(db_query("SELECT count(mlid) FROM {menu_links} WHERE link_path = '%s' AND module = 'menu'", $item['href'])) == 0) {
    $href        = 'user';
  }
  else {
    // We may want to do some breadcrumbing.
    return $item;
  }
  if (!empty($href)) {
    $item['href'] = $href;
    return $item;
  }
  return FALSE;
}

function menutrails_user($op, &$edit, &$account) {
  switch ($op) {
    case 'view':
    case 'form':
          $item = menutrails_user_location();
          if ($item) {
              menu_set_item(NULL, $item);
          }
    break;
    default:
  }
}

For the tracker module, I added the following line to tracker.pages.inc at the top of the tracker_page function:

module_invoke ('menutrails','user','view');