Changeset 4787
- Timestamp:
- 07/22/2011 12:40:24 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-forums/bp-forums-template.php
r4786 r4787 143 143 // For forum directories, get a true count 144 144 $status = is_super_admin() ? 'all' : 'public'; // todo: member-of 145 $topic_count = (int)groups_total_forum_topic_count( $status );145 $topic_count = (int)groups_total_forum_topic_count( $status, $search_terms ); 146 146 } 147 147 -
trunk/bp-groups/bp-groups-classes.php
r4770 r4787 607 607 * @return int The topic count 608 608 */ 609 function get_global_topic_count( $status = 'public' ) {609 function get_global_topic_count( $status = 'public', $search_terms = false ) { 610 610 global $bbdb, $wpdb, $bp; 611 611 … … 629 629 } 630 630 631 return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t INNER JOIN {$bp->groups->table_name_groupmeta} AS gm ON t.forum_id = gm.meta_value INNER JOIN {$bp->groups->table_name} AS g ON gm.group_id = g.id WHERE gm.meta_key = 'forum_id' {$status_sql} AND t.topic_status = '0' AND t.topic_sticky != '2' " ); 631 $sql = array(); 632 633 $sql['select'] = "SELECT COUNT(t.topic_id)"; 634 635 $sql['from'] = "FROM {$bbdb->topics} AS t INNER JOIN {$bp->groups->table_name_groupmeta} AS gm ON t.forum_id = gm.meta_value INNER JOIN {$bp->groups->table_name} AS g ON gm.group_id = g.id"; 636 637 $sql['where'] = "WHERE gm.meta_key = 'forum_id' {$status_sql} AND t.topic_status = '0' AND t.topic_sticky != '2'"; 638 639 if ( $search_terms ) { 640 $st = like_escape( $search_terms ); 641 $sql['where'] .= " AND ( t.topic_title LIKE '%{$st}%' )"; 642 } 643 644 return $wpdb->get_var( implode( ' ', $sql ) ); 632 645 } 633 646 } -
trunk/bp-groups/bp-groups-forums.php
r4764 r4787 258 258 * @return int The topic count 259 259 */ 260 function groups_total_forum_topic_count( $status = 'public' ) {261 return apply_filters( 'groups_total_forum_topic_count', BP_Groups_Group::get_global_topic_count( $status ) );260 function groups_total_forum_topic_count( $status = 'public', $search_terms = false ) { 261 return apply_filters( 'groups_total_forum_topic_count', BP_Groups_Group::get_global_topic_count( $status, $search_terms ) ); 262 262 } 263 263
Note: See TracChangeset
for help on using the changeset viewer.