Commit 8cfbe412 authored by Dries's avatar Dries

- Fixed a bug with taxonomy_get_related() returning the term which

  was passed in. Found by Moshe, fixed by Marco.
parent 53a53ce6
......@@ -354,7 +354,7 @@ function taxonomy_node_delete($nid) {
// relations: return array of related terms
function taxonomy_get_related($tid, $key = "tid") {
if ($tid) {
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '%s' OR tid2 = '%s') ORDER BY weight", $tid, $tid);
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '%d' OR tid2 = '%d') AND t.tid != '%d' ORDER BY weight", $tid, $tid, $tid);
$related = array();
while ($term = db_fetch_object($result)) {
$related[$term->$key] = $term;
......
......@@ -354,7 +354,7 @@ function taxonomy_node_delete($nid) {
// relations: return array of related terms
function taxonomy_get_related($tid, $key = "tid") {
if ($tid) {
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '%s' OR tid2 = '%s') ORDER BY weight", $tid, $tid);
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '%d' OR tid2 = '%d') AND t.tid != '%d' ORDER BY weight", $tid, $tid, $tid);
$related = array();
while ($term = db_fetch_object($result)) {
$related[$term->$key] = $term;
......
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