Ticket #932 (closed defect: fixed)

Opened 3 months ago

Last modified 2 months ago

tag pages broken -- get_tagged_topics() returns empty array

Reported by: zappoman Assigned to:
Priority: normal Milestone: 1.0-beta & XML-RPC
Component: Front-end Version: 1.0-beta (trunk)
Severity: major Keywords: tags upgrade taxonomy
Cc:

Description

Tag URLS don't list topics that are in the tags.

Tracing through it shows that get_tagged_topics() returns empty array.

This makes tag urls pretty much broken.

Since the BB_Query() appears to be a massive rewrite between 0.9.x and 1.0 I assume this is an issue in the new code. But I leave it to the experts. :)

Change History

08/17/08 09:40:22 changed by Potter_System

  • keywords changed from tags to works-for-me.

On [1651], everything seems OK with tags. May you check again after updating your SVN copy?

08/18/08 02:36:28 changed by zappoman

This is failing on the 1651 changeset for me. (I originally reported this against 1651).

08/18/08 07:13:50 changed by zappoman

I think this problem is related to the get_objects_in_term() function from class-bb-taxonomy.php.

Namely, the code on line 59 reads...

$sql = "SELECT tr.object_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($terms)";

But I thinkthat actually tt.term_id should be tt.term_taxonomy_id.

So, when I apply the following diff... it seems to work.

Index: bb-includes/class-bb-taxonomy.php
===================================================================
--- bb-includes/class-bb-taxonomy.php	(revision 1651)
+++ bb-includes/class-bb-taxonomy.php	(working copy)
@@ -56,7 +56,7 @@
 		$taxonomies = "'" . implode("', '", $taxonomies) . "'";
 		$terms = "'" . implode("', '", $terms) . "'";
 
-		$sql = "SELECT tr.object_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($terms)";
+		$sql = "SELECT tr.object_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_taxonomy_id IN ($terms)";
 		if ( $user_id )
 			$sql .= " AND tr.user_id = '$user_id'";
 		$sql .= " ORDER BY tr.object_id $order";

08/18/08 07:14:51 changed by zappoman

  • keywords changed from works-for-me to tags upgrade taxonomy.

09/09/08 05:29:57 changed by sambauers

  • milestone set to 1.0-beta & XML-RPC.

Was it after an upgrade that they disappeared?

09/10/08 20:54:15 changed by zappoman

yes...

Did you look at the diff I included?

at least in the version of the DB I have (after upgrading from the trunk) the $term variable includes term_taxonomy_id's not term_id's

When I change that, the code works...

Maybe this is an issue with upgrade... but it seems unlikely since my system works if I make this change.

09/22/08 12:25:39 changed by sambauers

  • status changed from new to closed.
  • resolution set to fixed.

(In [1722]) Fixes for query in get_objects_in_term(), was only noticeable when the column bb_term_taxonomy.term_id was different to bb_term_taxonomy.term_taxonomy_id on the requested tag - Fixes #932 - props zappoman