[buddypress-trac] [BuddyPress] #4306: Filter name 'groups_total_public_forum_topic_count' used in two places

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Wed Jun 27 12:40:59 UTC 2012

#4306: Filter name 'groups_total_public_forum_topic_count' used in two places
 Reporter:  DJPaul        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Groups        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |

Comment (by boonebgorges):

 Groan. It looks like it's been like this pretty much forever.


 It doesn't really look like anyone's using either, at least in a public
 plugin. I suggest that we keep the filter name in the function
 groups_total_public_forum_topic_count() (for consistency in naming, and
 because I'd think that this is the more likely place for people to have
 filtered), and then do something like the following in

 // Provide backward-compatibility for the
                 // SQL filter.
                 // Developers: DO NOT use this filter. Use
                 // See https://buddypress.trac.wordpress.org/ticket/4306
                 $maybe_extra_sql = apply_filters(
 'groups_total_public_forum_topic_count', $bp->groups->filter_sql, $type );

                 if ( is_int( $maybe_extra_sql ) ) {
                         $extra_sql = $bp->groups->filter_sql;
                 } else {
                         $extra_sql = $maybe_extra_sql;

                 // Developers: use this filter instead
                 $extra_sql = apply_filters(
 'get_global_forum_topic_count_extra_sql', $bp->groups->filter_sql, $type

 That way, if anyone is using the old filter for SQL reasons, it'll still
 work. It may also be worthwhile to do something similar in
 `groups_total_public_forum_topic_count()` (make sure that the filter
 returns an int value).

 Alternatively, we could just remove the filter and see what comes. It's
 dumb anyway :)

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4306#comment:1>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list