Last updated 8 November 2013. Created on 12 October 2006.
Edited by neocles, ihsanfaisal, horncologne, bryan kennedy. Log in to edit this page.

Knowing how to make the general taxonomy system fit with and support the requirements of a multiblog site can be tricky.

If a site has multiple blogs, but they all share the same vocabulary, there will be a problem trying to navigate using taxonomy links in a post.

I'll write here the code to make a term link go to a view with two arguments (the user id, and the term id).

In the full node view, the link in the terms will be like "blogterms/32/6"

  • blogterms will be a view.
  • 32 is the taxonomy term id
  • 6 is the user id (Remeber that the drupal blogs as listed using the author)

To obtain this link, in the node.tpl.php insert this php code for the terms linsting:

 if ($terms) {
  if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
    $result = db_query('SELECT uid FROM {node} WHERE nid = %d ORDER BY uid DESC', arg(1)); // search node author in full view mode
    $user = db_fetch_object($result);
    $uid = $user->uid;
    $nid = (int)arg(1);
  } else {
    $result = db_query('SELECT uid FROM {node} WHERE nid = %d ORDER BY uid DESC', $node->nid); // search node author when you are in the blog home (/blog/6)
    $user = db_fetch_object($result);
    $uid = $user->uid;
    $nid = $node->nid;
  }
}
$terms = taxonomy_node_get_terms($nid);
$output = "";
print t('Tags:').$output;

Then in the view "blogterms" you must use Arguments

Taxonomy: Term ID (The first argument)
User: UID is Author (The second argument)

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.