Skip to:
Content

BuddyPress.org

Changeset 4301


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

Creates queries for member Replied To tab. References #3177

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template.php

    r4299 r4301  
    3535        }
    3636    }
    37 
     37   
    3838    // Loop through each navigation item
    3939    foreach ( (array)$bp->bp_options_nav[$the_index] as $subnav_item ) {
  • 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?>
  • trunk/bp-forums/bp-forums-template.php

    r4211 r4301  
    230230    if ( !empty( $bp->displayed_user->id ) )
    231231        $user_id = $bp->displayed_user->id;
     232   
     233    // "Replied" query must be manually modified
     234    if ( 'replies' == bp_current_action() ) {
     235        $user_id = 0; // User id must be handled manually by the filter, not by BB_Query
     236       
     237        add_filter( 'get_topics_distinct',   'bp_forums_add_replied_distinct_sql', 20 );
     238        add_filter( 'get_topics_join',       'bp_forums_add_replied_join_sql', 20 );
     239        add_filter( 'get_topics_where',      'bp_forums_add_replied_where_sql', 20  );
     240    }
    232241
    233242    // If we're in a single group, set this group's forum_id
  • trunk/bp-groups/bp-groups-filters.php

    r4269 r4301  
    7979    global $bp;
    8080   
    81     $sql .= ', ' . $bp->groups->table_name . ' AS g LEFT JOIN ' . $bp->groups->table_name_groupmeta . ' AS gm ON g.id = gm.group_id ';
     81    $sql .= 'JOIN ' . $bp->groups->table_name . ' AS g LEFT JOIN ' . $bp->groups->table_name_groupmeta . ' AS gm ON g.id = gm.group_id ';
    8282   
    8383    return $sql;
  • trunk/bp-themes/bp-default/forums/forums-loop.php

    r4287 r4301  
    3939                <th id="th-title"><?php _e( 'Topic Title', 'buddypress' ); ?></th>
    4040
    41                 <?php if ( bp_is_directory() ) : ?>
     41                <?php if ( bp_is_directory() || bp_is_user_forums() ) : ?>
    4242
    4343                    <th id="th-group"><?php _e( 'Forum', 'buddypress' ); ?></th>
     
    6767                </td>
    6868
    69                 <?php if ( bp_is_directory() ) : ?>
     69                <?php if ( bp_is_directory() || bp_is_user_forums() ) : ?>
    7070
    7171                    <td class="td-group">
  • trunk/bp-themes/bp-default/members/single/forums.php

    r3933 r4301  
    1212<div class="item-list-tabs no-ajax" id="subnav" role="navigation">
    1313    <ul>
    14         <?php if ( bp_is_my_profile() ) bp_get_options_nav(); ?>
     14        <?php bp_get_options_nav() ?>
    1515
    1616        <li id="forums-order-select" class="last filter">
Note: See TracChangeset for help on using the changeset viewer.