Skip to:
Content

Ignore:
Timestamp:
12/08/2017 12:22:09 AM (6 months ago)
Author:
djpaul
Message:

Retire Legacy Forums.

"Legacy Forums" is what we now call the bundled version of bbPress 1 that has shipped with BuddyPress for over nine years. The Legacy Forums codebase/features are many years stagnant, and it has been almost completely hidden from the UI for the past five years.

Legacy Forums were replaced by bbPress 2, which is its own plugin, and we've been promoting its integration with BuddyPress for a long time. Most significantly, bbPress 1 only runs on WordPress versions older than 4.7, because of a BackPress conflict (which is nested inside bbPress 1) with WordPress 4.7's WP_Taxonomy class.

If your site is still using Legacy Forums, you will need to migrate to bbPress 2 to run BuddyPress 3.0. See https://bpdevel.wordpress.com/2017/12/07/legacy-forums-support-will-be/ for more information.

Fixes #5351
See #7502

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/classes/class-bp-groups-group.php

    r11762 r11763  
    7979
    8080    /**
    81      * Should (legacy) bbPress forums be enabled for this group?
    82      *
    83      * @since 1.6.0
     81     * Controls whether the group has a forum enabled.
     82     *
     83     * @since 1.6.0
     84     * @since 3.0.0 Previously, this referred to Legacy Forums. It's still used by bbPress 2 for integration.
     85     *
    8486     * @var int
    8587     */
     
    14571459
    14581460    /**
    1459      * Get a list of groups, sorted by those that have the most legacy forum topics.
     1461     * Convert the 'orderby' param into a proper SQL term/column.
     1462     *
     1463     * @since 1.8.0
     1464     *
     1465     * @param string $orderby Orderby term as passed to get().
     1466     * @return string $order_by_term SQL-friendly orderby term.
     1467     */
     1468    protected static function convert_orderby_to_order_by_term( $orderby ) {
     1469        $order_by_term = '';
     1470
     1471        switch ( $orderby ) {
     1472            case 'date_created' :
     1473            default :
     1474                $order_by_term = 'g.date_created';
     1475                break;
     1476
     1477            case 'last_activity' :
     1478                $order_by_term = 'gm_last_activity.meta_value';
     1479                break;
     1480
     1481            case 'total_member_count' :
     1482                $order_by_term = 'CONVERT(gm_total_member_count.meta_value, SIGNED)';
     1483                break;
     1484
     1485            case 'name' :
     1486                $order_by_term = 'g.name';
     1487                break;
     1488
     1489            case 'random' :
     1490                $order_by_term = 'rand()';
     1491                break;
     1492
     1493            case 'meta_id' :
     1494                $order_by_term = buddypress()->groups->table_name_groupmeta . '.id';
     1495                break;
     1496        }
     1497
     1498        return $order_by_term;
     1499    }
     1500
     1501    /**
     1502     * Get a list of groups whose names start with a given letter.
     1503     *
     1504     * @since 1.6.0
     1505     *
     1506     * @param string            $letter          The letter.
     1507     * @param int|null          $limit           Optional. The max number of results to return.
     1508     *                                           Default: null (no limit).
     1509     * @param int|null          $page            Optional. The page offset of results to return.
     1510     *                                           Default: null (no limit).
     1511     * @param bool              $populate_extras Deprecated.
     1512     * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
     1513     *                                           IDs to exclude from results.
     1514     * @return false|array {
     1515     *     @type array $groups Array of group objects returned by the
     1516     *                         paginated query.
     1517     *     @type int   $total  Total count of all groups matching non-
     1518     *                         paginated query params.
     1519     * }
     1520     */
     1521    public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
     1522        global $wpdb;
     1523
     1524        $pag_sql = $hidden_sql = $exclude_sql = '';
     1525
     1526        // Multibyte compliance.
     1527        if ( function_exists( 'mb_strlen' ) ) {
     1528            if ( mb_strlen( $letter, 'UTF-8' ) > 1 || is_numeric( $letter ) || !$letter ) {
     1529                return false;
     1530            }
     1531        } else {
     1532            if ( strlen( $letter ) > 1 || is_numeric( $letter ) || !$letter ) {
     1533                return false;
     1534            }
     1535        }
     1536
     1537        $args = array(
     1538            'per_page'       => $limit,
     1539            'page'           => $page,
     1540            'search_terms'   => $letter . '*',
     1541            'search_columns' => array( 'name' ),
     1542            'exclude'        => $exclude,
     1543        );
     1544
     1545        return BP_Groups_Group::get( $args );
     1546    }
     1547
     1548    /**
     1549     * Get a list of random groups.
     1550     *
     1551     * Use BP_Groups_Group::get() with 'type' = 'random' instead.
    14601552     *
    14611553     * @since 1.6.0
     
    14801572     * }
    14811573     */
    1482     public static function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
    1483         global $wpdb, $bbdb;
    1484 
    1485         if ( empty( $bbdb ) ) {
    1486 
    1487             /** This action is documented in bp-forums/bp-forums-screens */
    1488             do_action( 'bbpress_init' );
    1489         }
    1490 
    1491         if ( !empty( $limit ) && !empty( $page ) ) {
    1492             $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    1493         }
    1494 
    1495         if ( !is_user_logged_in() || ( !bp_current_user_can( 'bp_moderate' ) && ( $user_id != bp_loggedin_user_id() ) ) )
    1496             $hidden_sql = " AND g.status != 'hidden'";
    1497 
    1498         if ( !empty( $search_terms ) ) {
    1499             $search_terms_like = '%' . bp_esc_like( $search_terms ) . '%';
    1500             $search_sql        = $wpdb->prepare( ' AND ( g.name LIKE %s OR g.description LIKE %s ) ', $search_terms_like, $search_terms_like );
    1501         }
    1502 
    1503         if ( !empty( $exclude ) ) {
    1504             $exclude     = implode( ',', wp_parse_id_list( $exclude ) );
    1505             $exclude_sql = " AND g.id NOT IN ({$exclude})";
    1506         }
    1507 
    1508         $bp = buddypress();
    1509 
    1510         if ( !empty( $user_id ) ) {
    1511             $user_id      = absint( esc_sql( $user_id ) );
    1512             $paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bp->groups->table_name_members} m, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 {$exclude_sql} ORDER BY f.topics DESC {$pag_sql}" );
    1513             $total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 {$exclude_sql}" );
    1514         } else {
    1515             $paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql} {$exclude_sql} ORDER BY f.topics DESC {$pag_sql}" );
    1516             $total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.topics > 0 {$hidden_sql} {$search_sql} {$exclude_sql}" );
    1517         }
    1518 
    1519         if ( !empty( $populate_extras ) ) {
    1520             foreach ( (array) $paged_groups as $group ) {
    1521                 $group_ids[] = $group->id;
    1522             }
    1523             $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    1524         }
    1525 
    1526         return array( 'groups' => $paged_groups, 'total' => $total_groups );
    1527     }
    1528 
    1529     /**
    1530      * Convert the 'orderby' param into a proper SQL term/column.
    1531      *
    1532      * @since 1.8.0
    1533      *
    1534      * @param string $orderby Orderby term as passed to get().
    1535      * @return string $order_by_term SQL-friendly orderby term.
    1536      */
    1537     protected static function convert_orderby_to_order_by_term( $orderby ) {
    1538         $order_by_term = '';
    1539 
    1540         switch ( $orderby ) {
    1541             case 'date_created' :
    1542             default :
    1543                 $order_by_term = 'g.date_created';
    1544                 break;
    1545 
    1546             case 'last_activity' :
    1547                 $order_by_term = 'gm_last_activity.meta_value';
    1548                 break;
    1549 
    1550             case 'total_member_count' :
    1551                 $order_by_term = 'CONVERT(gm_total_member_count.meta_value, SIGNED)';
    1552                 break;
    1553 
    1554             case 'name' :
    1555                 $order_by_term = 'g.name';
    1556                 break;
    1557 
    1558             case 'random' :
    1559                 $order_by_term = 'rand()';
    1560                 break;
    1561 
    1562             case 'meta_id' :
    1563                 $order_by_term = buddypress()->groups->table_name_groupmeta . '.id';
    1564                 break;
    1565         }
    1566 
    1567         return $order_by_term;
    1568     }
    1569 
    1570     /**
    1571      * Get a list of groups, sorted by those that have the most legacy forum posts.
    1572      *
    1573      * @since 1.6.0
    1574      *
    1575      * @param int|null          $limit           Optional. The max number of results to return.
    1576      *                                           Default: null (no limit).
    1577      * @param int|null          $page            Optional. The page offset of results to return.
    1578      *                                           Default: null (no limit).
    1579      * @param string|bool       $search_terms    Optional. Limit groups to those whose name
    1580      *                                           or description field contain the search string.
    1581      * @param bool              $populate_extras Optional. Whether to fetch extra
    1582      *                                           information about the groups. Default: true.
    1583      * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
    1584      *                                           IDs to exclude from results.
    1585      * @return array {
    1586      *     @type array $groups Array of group objects returned by the
    1587      *                         paginated query.
    1588      *     @type int   $total  Total count of all groups matching non-
    1589      *                         paginated query params.
    1590      * }
    1591      */
    1592     public static function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {
    1593         global $wpdb, $bbdb;
    1594 
    1595         if ( empty( $bbdb ) ) {
    1596 
    1597             /** This action is documented in bp-forums/bp-forums-screens */
    1598             do_action( 'bbpress_init' );
    1599         }
    1600 
    1601         if ( !empty( $limit ) && !empty( $page ) ) {
    1602             $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    1603         }
    1604 
    1605         if ( !is_user_logged_in() || ( !bp_current_user_can( 'bp_moderate' ) && ( $user_id != bp_loggedin_user_id() ) ) )
    1606             $hidden_sql = " AND g.status != 'hidden'";
    1607 
    1608         if ( !empty( $search_terms ) ) {
    1609             $search_terms_like = '%' . bp_esc_like( $search_terms ) . '%';
    1610             $search_sql        = $wpdb->prepare( ' AND ( g.name LIKE %s OR g.description LIKE %s ) ', $search_terms_like, $search_terms_like );
    1611         }
    1612 
    1613         if ( !empty( $exclude ) ) {
    1614             $exclude     = implode( ',', wp_parse_id_list( $exclude ) );
    1615             $exclude_sql = " AND g.id NOT IN ({$exclude})";
    1616         }
    1617 
    1618         $bp = buddypress();
    1619 
    1620         if ( !empty( $user_id ) ) {
    1621             $user_id = esc_sql( $user_id );
    1622             $paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bp->groups->table_name_members} m, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 {$exclude_sql} ORDER BY f.posts ASC {$pag_sql}" );
    1623             $total_groups = $wpdb->get_results( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bp->groups->table_name_members} m, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = m.group_id AND g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.posts > 0 {$hidden_sql} {$search_sql} AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0 {$exclude_sql} " );
    1624         } else {
    1625             $paged_groups = $wpdb->get_results( "SELECT DISTINCT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) AND f.posts > 0 {$hidden_sql} {$search_sql} {$exclude_sql} ORDER BY f.posts ASC {$pag_sql}" );
    1626             $total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name_groupmeta} gm3, {$bbdb->forums} f, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND g.id = gm3.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND (gm3.meta_key = 'forum_id' AND gm3.meta_value = f.forum_id) {$hidden_sql} {$search_sql} {$exclude_sql}" );
    1627         }
    1628 
    1629         if ( !empty( $populate_extras ) ) {
    1630             foreach ( (array) $paged_groups as $group ) {
    1631                 $group_ids[] = $group->id;
    1632             }
    1633             $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    1634         }
    1635 
    1636         return array( 'groups' => $paged_groups, 'total' => $total_groups );
    1637     }
    1638 
    1639     /**
    1640      * Get a list of groups whose names start with a given letter.
    1641      *
    1642      * @since 1.6.0
    1643      *
    1644      * @param string            $letter          The letter.
    1645      * @param int|null          $limit           Optional. The max number of results to return.
    1646      *                                           Default: null (no limit).
    1647      * @param int|null          $page            Optional. The page offset of results to return.
    1648      *                                           Default: null (no limit).
    1649      * @param bool              $populate_extras Deprecated.
    1650      * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
    1651      *                                           IDs to exclude from results.
    1652      * @return false|array {
    1653      *     @type array $groups Array of group objects returned by the
    1654      *                         paginated query.
    1655      *     @type int   $total  Total count of all groups matching non-
    1656      *                         paginated query params.
    1657      * }
    1658      */
    1659     public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
    1660         global $wpdb;
    1661 
    1662         $pag_sql = $hidden_sql = $exclude_sql = '';
    1663 
    1664         // Multibyte compliance.
    1665         if ( function_exists( 'mb_strlen' ) ) {
    1666             if ( mb_strlen( $letter, 'UTF-8' ) > 1 || is_numeric( $letter ) || !$letter ) {
    1667                 return false;
    1668             }
    1669         } else {
    1670             if ( strlen( $letter ) > 1 || is_numeric( $letter ) || !$letter ) {
    1671                 return false;
    1672             }
    1673         }
    1674 
    1675         $args = array(
    1676             'per_page'       => $limit,
    1677             'page'           => $page,
    1678             'search_terms'   => $letter . '*',
    1679             'search_columns' => array( 'name' ),
    1680             'exclude'        => $exclude,
    1681         );
    1682 
    1683         return BP_Groups_Group::get( $args );
    1684     }
    1685 
    1686     /**
    1687      * Get a list of random groups.
    1688      *
    1689      * Use BP_Groups_Group::get() with 'type' = 'random' instead.
    1690      *
    1691      * @since 1.6.0
    1692      *
    1693      * @param int|null          $limit           Optional. The max number of results to return.
    1694      *                                           Default: null (no limit).
    1695      * @param int|null          $page            Optional. The page offset of results to return.
    1696      *                                           Default: null (no limit).
    1697      * @param int               $user_id         Optional. If present, groups will be limited to
    1698      *                                           those of which the specified user is a member.
    1699      * @param string|bool       $search_terms    Optional. Limit groups to those whose name
    1700      *                                           or description field contain the search string.
    1701      * @param bool              $populate_extras Optional. Whether to fetch extra
    1702      *                                           information about the groups. Default: true.
    1703      * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
    1704      *                                           IDs to exclude from results.
    1705      * @return array {
    1706      *     @type array $groups Array of group objects returned by the
    1707      *                         paginated query.
    1708      *     @type int   $total  Total count of all groups matching non-
    1709      *                         paginated query params.
    1710      * }
    1711      */
    17121574    public static function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
    17131575        $args = array(
     
    17941656
    17951657    /**
    1796      * Get global count of forum topics in public groups (legacy forums).
    1797      *
    1798      * @since 1.6.0
    1799      *
    1800      * @param string $type Optional. If 'unreplied', count will be limited to
    1801      *                     those topics that have received no replies.
    1802      * @return int Forum topic count.
    1803      */
    1804     public static function get_global_forum_topic_count( $type ) {
    1805         global $bbdb, $wpdb;
    1806 
    1807         $bp = buddypress();
    1808 
    1809         if ( 'unreplied' == $type )
    1810             $bp->groups->filter_sql = ' AND t.topic_posts = 1';
    1811 
    1812         /**
    1813          * Filters the portion of the SQL related to global count of forum topics in public groups.
    1814          *
    1815          * See https://buddypress.trac.wordpress.org/ticket/4306.
    1816          *
    1817          * @since 1.6.0
    1818          *
    1819          * @param string $filter_sql SQL portion for the query.
    1820          * @param string $type       Type of forum topics to query for.
    1821          */
    1822         $extra_sql = apply_filters( 'get_global_forum_topic_count_extra_sql', $bp->groups->filter_sql, $type );
    1823 
    1824         // Make sure the $extra_sql begins with an AND.
    1825         if ( 'AND' != substr( trim( strtoupper( $extra_sql ) ), 0, 3 ) )
    1826             $extra_sql = ' AND ' . $extra_sql;
    1827 
    1828         return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND t.topic_status = '0' AND t.topic_sticky != '2' {$extra_sql} " );
    1829     }
    1830 
    1831     /**
    18321658     * Get the member count for a group.
    18331659     *
     
    18431669
    18441670        return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
    1845     }
    1846 
    1847     /**
    1848      * Get a total count of all topics of a given status, across groups/forums.
    1849      *
    1850      * @since 1.5.0
    1851      *
    1852      * @param string      $status       Which group type to count. 'public', 'private',
    1853      *                                  'hidden', or 'all'. Default: 'public'.
    1854      * @param string|bool $search_terms Provided search terms.
    1855      * @return int The topic count
    1856      */
    1857     public static function get_global_topic_count( $status = 'public', $search_terms = false ) {
    1858         global $bbdb, $wpdb;
    1859 
    1860         switch ( $status ) {
    1861             case 'all' :
    1862                 $status_sql = '';
    1863                 break;
    1864 
    1865             case 'hidden' :
    1866                 $status_sql = "AND g.status = 'hidden'";
    1867                 break;
    1868 
    1869             case 'private' :
    1870                 $status_sql = "AND g.status = 'private'";
    1871                 break;
    1872 
    1873             case 'public' :
    1874             default :
    1875                 $status_sql = "AND g.status = 'public'";
    1876                 break;
    1877         }
    1878 
    1879         $bp = buddypress();
    1880 
    1881         $sql = array();
    1882 
    1883         $sql['select'] = "SELECT COUNT(t.topic_id)";
    1884         $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";
    1885         $sql['where']  = "WHERE gm.meta_key = 'forum_id' {$status_sql} AND t.topic_status = '0' AND t.topic_sticky != '2'";
    1886 
    1887         if ( !empty( $search_terms ) ) {
    1888             $search_terms_like = '%' . bp_esc_like( $search_terms ) . '%';
    1889             $sql['where'] .= $wpdb->prepare( " AND ( t.topic_title LIKE %s )", $search_terms_like );
    1890         }
    1891 
    1892         return $wpdb->get_var( implode( ' ', $sql ) );
    18931671    }
    18941672
Note: See TracChangeset for help on using the changeset viewer.