[buddypress-trac] [BuddyPress] #2674: bp-activity-classes.php: add a sql statements filter

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sun Apr 10 17:19:31 UTC 2011


#2674: bp-activity-classes.php: add a sql statements filter
--------------------------+--------------------
  Reporter:  aesqe        |      Owner:
      Type:  enhancement  |     Status:  closed
  Priority:  trivial      |  Milestone:  1.3
 Component:  Activity     |    Version:
Resolution:  fixed        |   Keywords:  filter
--------------------------+--------------------

Comment (by aesqe):

 Replying to [comment:7 DJPaul]:
 > These queries are typically built from associative arrays, which are
 passed to these filters.

 Maybe I'm looking at the wrong thing, but in the
 [https://trac.buddypress.org/browser/trunk/bp-activity/bp-activity-
 classes.php trunk version of bp-activity-classes.php], $where_sql is not
 passed to the 'bp_activity_get_user_join_filter':

 {{{
 $wpdb->get_results(
         apply_filters(
                 'bp_activity_get_user_join_filter',
                 $wpdb->prepare(
                         "{$select_sql} {$from_sql} {$where_sql} ORDER BY
 a.date_recorded {$sort} {$pag_sql}",
                         $select_sql, $from_sql, $where_sql, $sort,
 $pag_sql
                 )
         )
 );
 }}}

 if it were passed to the filter, that's all I would need :)

 anyhow, the code above looks kind of wrong, are you sure it's not supposed
 to be:

 {{{
 $wpdb->get_results(
         apply_filters(
                 'bp_activity_get_user_join_filter',
                 $wpdb->prepare(
                         "%s %s %s ORDER BY a.date_recorded %s %s",
                         $select_sql, $from_sql, $where_sql, $sort,
 $pag_sql
                 ),
                 $select_sql, $from_sql, $where_sql, $sort, $pag_sql
         )
 );
 }}}

 or

 {{{
 $wpdb->get_results(
         apply_filters(
                 'bp_activity_get_user_join_filter',
                 "{$select_sql} {$from_sql} {$where_sql} ORDER BY
 a.date_recorded {$sort} {$pag_sql}",
                 $select_sql, $from_sql, $where_sql, $sort, $pag_sql
         )
 );
 }}}

 (and I apologize in advance if I'm misreading something :|)

-- 
Ticket URL: <https://trac.buddypress.org/ticket/2674#comment:8>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list