Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/29/2011 07:39:38 PM (15 years ago)
Author:
boonebgorges
Message:

Creates queries for member Replied To tab. References #3177

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-filters.php

    r4268 r4301  
    132132add_filter( 'bp_get_the_topic_post_edit_text', 'bp_forums_strip_mentions_on_post_edit' );
    133133add_filter( 'bp_get_the_topic_text', 'bp_forums_strip_mentions_on_post_edit' );
     134
     135/**
     136 * "REPLIED TO" SQL FILTERS
     137 */
     138
     139/**
     140 * Filters the get_topics_distinct portion of the Forums sql when on a user's Replied To page.
     141 *
     142 * This filter is added in bp_has_forum_topics()
     143 *
     144 * @package BuddyPress
     145 * @since 1.3
     146 *
     147 * @global object $wpdb The WordPress database global
     148 * @param string $sql
     149 * @return string $sql
     150 */
     151function bp_forums_add_replied_distinct_sql( $sql ) {
     152    global $wpdb;
     153   
     154    $sql = $wpdb->prepare( "DISTINCT t.topic_id, " );
     155   
     156    return $sql;
     157}
     158
     159/**
     160 * Filters the get_topics_join portion of the Forums sql when on a user's Replied To page.
     161 *
     162 * This filter is added in bp_has_forum_topics()
     163 *
     164 * @package BuddyPress
     165 * @since 1.3
     166 *
     167 * @global object $bbdb The bbPress database global
     168 * @global object $wpdb The WordPress database global
     169 * @param string $sql
     170 * @return string $sql
     171 */
     172function bp_forums_add_replied_join_sql( $sql ) {
     173    global $bbdb, $wpdb;
     174   
     175    $sql .= $wpdb->prepare( " LEFT JOIN $bbdb->posts p ON p.topic_id = t.topic_id " );
     176   
     177    return $sql;
     178}
     179
     180/**
     181 * Filters the get_topics_where portion of the Forums sql when on a user's Replied To page.
     182 *
     183 * This filter is added in bp_has_forum_topics()
     184 *
     185 * @package BuddyPress
     186 * @since 1.3
     187 *
     188 * @global object $wpdb The WordPress database global
     189 * @param string $sql
     190 * @return string $sql
     191 */
     192function bp_forums_add_replied_where_sql( $sql ) {
     193    global $wpdb;
     194   
     195    $sql .= $wpdb->prepare( " AND p.poster_id = %s ", bp_displayed_user_id() );
     196
     197    return $sql;
     198}
     199
    134200?>
Note: See TracChangeset for help on using the changeset viewer.