[Bb-trac] Re: [bbPress] #932: tag pages broken -- get_tagged_topics() returns empty array

bbPress bb-trac at lists.bbpress.org
Mon Aug 18 07:13:50 GMT 2008


#932: tag pages broken -- get_tagged_topics() returns empty array
--------------------------+-------------------------------------------------
 Reporter:  zappoman      |        Owner:                  
     Type:  defect        |       Status:  new             
 Priority:  normal        |    Milestone:                  
Component:  Front-end     |      Version:  1.0-beta (trunk)
 Severity:  major         |   Resolution:                  
 Keywords:  works-for-me  |  
--------------------------+-------------------------------------------------
Comment (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";
 }}}

-- 
Ticket URL: <http://trac.bbpress.org/ticket/932#comment:3>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list