--- faq.module	2007/11/13 12:02:17	1.1.4.63.2.5
+++ faq.module	2007/12/10 10:42:12	1.1.4.63.2.7
@@ -1,5 +1,5 @@
 <?php
-// $Id: faq.module,v 1.1.4.63.2.5 2007/11/13 12:02:17 snpower Exp $
+// $Id: faq.module,v 1.1.4.63.2.7 2007/12/10 10:42:12 snpower Exp $
 
 /**
  * Display help and module information
@@ -1899,3 +1899,24 @@
   $output = faq_get_faq_list();
   return theme('box', $title, $output);
 }
+
+function faq_link_alter(&$node, &$links) {
+  if (!variable_get('faq_use_categories', FALSE) || !module_exists("taxonomy")) {
+    return;
+  }
+  $vocabularies = taxonomy_get_vocabularies("faq");
+  foreach ($links as $module => $link) {
+    if (strstr($module, 'taxonomy_term')) {
+      // Link back to the faq and not the taxonomy term page. We'll only
+      // do this if the taxonomy term in question belongs to faq vocab.
+      $tid = str_replace('taxonomy/term/', '', $link['href']);
+      $term = taxonomy_get_term($tid);
+      foreach ($vocabularies as $vid => $vobj) {
+        if ($term->vid == $vid) {
+          $links[$module]['href'] = str_replace('taxonomy/term', 'faq', $link['href']);
+          break;
+        }
+      }
+    }
+  }
+}