Ok, so it's not a patch, but here's my suggestion:

taxonomy_link() generates the links used in the "submitted by x in category foo" section of nodes (and probably other places). The link it generates is "taxonomy/term/whatever". This is great for stories, but for other node types it isn't.

I've squeezed in a simple if() to check if the node is a forum post. If it is, then it generates a link of the format "forum/whatever" so that the user is directed to the regular forum listing instead of an ugly node listing.

function taxonomy_link($type, $node = NULL) {
  if ($type == 'taxonomy terms' && $node != NULL) {

    $links = array();
    if (array_key_exists('taxonomy', $node)) {
      foreach ($node->taxonomy as $tid) {
        $term = taxonomy_get_term($tid);
        if ($node->type == 'forum') {
          $links[] = l($term->name, 'forum/'. $term->tid);
        } else {
          $links[] = l($term->name, 'taxonomy/term/'. $term->tid);
        }
      }
    }
    else {
      $links = array();
      foreach (taxonomy_node_get_terms($node->nid) as $term) {
        if ($node->type == 'forum') {
          $links[] = l($term->name, 'forum/'. $term->tid);
        } else {
          $links[] = l($term->name, 'taxonomy/term/'. $term->tid);
        }
      }

    }
    return $links;
  }
}
CommentFileSizeAuthor
#1 taxonomy.module.use_forum_links.patch1.14 KBpfaocle
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfaocle’s picture

Here's a patch for the suggestion.

I like it. Showing the taxonomy information for different types of posts should be looked at, as these links need to be tailored for certain node types. It would be nice if a module for a particular node type could specify the link or callback to show different 'variants' of taxonomy listings.

Off the top of my head, this applies to:

  • forum posts -> posted in forum/tid
  • images -> posted in image/tid/tid
magico’s picture

Version: 4.6.0 » x.y.z
Status: Active » Needs work
Stefan Nagtegaal’s picture

Status: Needs work » Fixed

Since drupal 5 we have a new hook hook todo such things nicely.. In drupal 6 we can (ab)use the menu system for this.

Anonymous’s picture

Status: Fixed » Closed (fixed)
Josh The Geek’s picture

Version: x.y.z » 4.6.0

Change version.