Commit 6777fdb1 authored by Steven Wittens's avatar Steven Wittens

- #26583: Make forum taxonomy links redirect to forums rather than taxonomy pages.

parent a9260fa2
......@@ -434,6 +434,10 @@ function forum_link($type, $node = 0, $main = 0) {
return $links;
}
function forum_term_path($term) {
return 'forum/'. $term->tid;
}
/**
* Implementation of hook_menu().
*/
......
......@@ -434,6 +434,10 @@ function forum_link($type, $node = 0, $main = 0) {
return $links;
}
function forum_term_path($term) {
return 'forum/'. $term->tid;
}
/**
* Implementation of hook_menu().
*/
......
......@@ -30,18 +30,26 @@ function taxonomy_link($type, $node = NULL) {
if (array_key_exists('taxonomy', $node)) {
foreach ($node->taxonomy as $tid) {
$term = taxonomy_get_term($tid);
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
$links[] = l($term->name, taxonomy_term_path($term));
}
}
else {
foreach (taxonomy_node_get_terms($node->nid) as $term) {
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
$links[] = l($term->name, taxonomy_term_path($term));
}
}
return $links;
}
}
function taxonomy_term_path($term) {
$vocabulary = taxonomy_get_vocabulary($term->vid);
if ($vocabulary->module != 'taxonomy' && $path = module_invoke($vocabulary->module, 'term_path', $term)) {
return $path;
}
return 'taxonomy/term/'. $term->tid;
}
/**
* Implementation of hook_menu().
*/
......@@ -866,16 +874,20 @@ function taxonomy_get_term_by_name($name) {
* Return the vocabulary object matching a vocabulary ID.
*/
function taxonomy_get_vocabulary($vid) {
$result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d ORDER BY v.weight, v.name', $vid);
$node_types = array();
while ($voc = db_fetch_object($result)) {
$node_types[] = $voc->type;
unset($voc->type);
$voc->nodes = $node_types;
$vocabulary = $voc;
static $vocabularies = array();
if (!array_key_exists($vid, $vocabularies)) {
$result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d ORDER BY v.weight, v.name', $vid);
$node_types = array();
while ($voc = db_fetch_object($result)) {
$node_types[] = $voc->type;
unset($voc->type);
$voc->nodes = $node_types;
$vocabularies[$vid] = $voc;
}
}
return $vocabulary;
return $vocabularies[$vid];
}
/**
......
......@@ -30,18 +30,26 @@ function taxonomy_link($type, $node = NULL) {
if (array_key_exists('taxonomy', $node)) {
foreach ($node->taxonomy as $tid) {
$term = taxonomy_get_term($tid);
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
$links[] = l($term->name, taxonomy_term_path($term));
}
}
else {
foreach (taxonomy_node_get_terms($node->nid) as $term) {
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
$links[] = l($term->name, taxonomy_term_path($term));
}
}
return $links;
}
}
function taxonomy_term_path($term) {
$vocabulary = taxonomy_get_vocabulary($term->vid);
if ($vocabulary->module != 'taxonomy' && $path = module_invoke($vocabulary->module, 'term_path', $term)) {
return $path;
}
return 'taxonomy/term/'. $term->tid;
}
/**
* Implementation of hook_menu().
*/
......@@ -866,16 +874,20 @@ function taxonomy_get_term_by_name($name) {
* Return the vocabulary object matching a vocabulary ID.
*/
function taxonomy_get_vocabulary($vid) {
$result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d ORDER BY v.weight, v.name', $vid);
$node_types = array();
while ($voc = db_fetch_object($result)) {
$node_types[] = $voc->type;
unset($voc->type);
$voc->nodes = $node_types;
$vocabulary = $voc;
static $vocabularies = array();
if (!array_key_exists($vid, $vocabularies)) {
$result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d ORDER BY v.weight, v.name', $vid);
$node_types = array();
while ($voc = db_fetch_object($result)) {
$node_types[] = $voc->type;
unset($voc->type);
$voc->nodes = $node_types;
$vocabularies[$vid] = $voc;
}
}
return $vocabulary;
return $vocabularies[$vid];
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment