[Bb-trac] [bbPress] #1054: get_forum applies filter incorrectly

bbPress bb-trac at lists.bbpress.org
Tue Mar 17 23:13:49 GMT 2009


#1054: get_forum applies filter incorrectly
----------------------+-----------------------------------------------------
 Reporter:  _ck_      |       Owner:             
     Type:  defect    |      Status:  new        
 Priority:  normal    |   Milestone:  1.0-beta   
Component:  Back-end  |     Version:  1.0-alpha-6
 Severity:  normal    |    Keywords:             
----------------------+-----------------------------------------------------
 for some reason in 1.0a6 the `get_forum` function (singular) apples the
 get_forum_where filter incorrectly.

 It sends a blank query and ADDS the result of the filter to it's query
 instead of sending the filter the current query and accepting the results
 as the new query.

 This is different than the behavior for all other `_where` filters and
 makes it impossible to determine if an "AND" or "WHERE" should be appended
 to the query.

 current code:

 {{{
         if ( $where = apply_filters( 'get_forum_where', '' ) ) {
                 $forum = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM
 $bbdb->forums WHERE forum_id = %d", $id ) . " $where" );
                 return bb_append_meta( $forum, 'forum' );

 }}}


 how it should be


 {{{
         if ( $where = apply_filters( 'get_forum_where', 'WHERE forum_id =
 $id' ) ) {
                 $forum = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM
 $bbdb->forums $where);
                 return bb_append_meta( $forum, 'forum' );

 }}}

-- 
Ticket URL: <http://trac.bbpress.org/ticket/1054>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list