Changeset 3386
- Timestamp:
- 08/07/2011 04:21:43 AM (14 years ago)
- Location:
- branches/plugin
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-common-template.php
r3384 r3386 234 234 */ 235 235 function bbp_is_topic_tag() { 236 237 if ( is_tax( bbp_get_topic_tag_tax_id() ) ) 236 global $bbp; 237 238 if ( is_tax( bbp_get_topic_tag_tax_id() ) || !empty( $bbp->topic_query->is_tax ) ) 238 239 return true; 239 240 -
branches/plugin/bbp-includes/bbp-core-compatibility.php
r3374 r3386 245 245 'post_content' => get_the_content(), 246 246 'post_type' => get_post_type(), 247 'post_status' => get_post_status() 247 'post_status' => get_post_status(), 248 'is_404' => false, 249 'is_page' => false, 250 'is_single' => false, 251 'is_archive' => false, 252 'is_tax' => false, 248 253 ); 249 254 … … 257 262 'post_content' => '', 258 263 'post_type' => 'page', 259 'post_status' => 'publish' 264 'post_status' => 'publish', 265 'is_404' => false, 266 'is_page' => false, 267 'is_single' => false, 268 'is_archive' => false, 269 'is_tax' => false, 260 270 ); 261 271 } 262 272 $dummy = wp_parse_args( $args, $defaults ); 273 274 // Clear out the post related globals 275 unset( $wp_query->posts ); 276 unset( $wp_query->post ); 277 unset( $post ); 263 278 264 279 // Setup the dummy post object … … 275 290 276 291 // Setup the dummy post loop 277 $wp_query->posts[ ] = $wp_query->post;292 $wp_query->posts[0] = $wp_query->post; 278 293 279 294 // Prevent comments form from appearing 280 295 $wp_query->post_count = 1; 281 $wp_query->is_404 = false;282 $wp_query->is_page = false;283 $wp_query->is_single = false;284 $wp_query->is_archive = false;285 $wp_query->is_tax = false;296 $wp_query->is_404 = $dummy['is_404']; 297 $wp_query->is_page = $dummy['is_page']; 298 $wp_query->is_single = $dummy['is_single']; 299 $wp_query->is_archive = $dummy['is_archive']; 300 $wp_query->is_tax = $dummy['is_tax']; 286 301 287 302 // If we are resetting a post, we are in theme compat … … 707 722 708 723 // Viewing a user 709 if ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template()) ) :724 if ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) : 710 725 711 726 // Editing a user 712 elseif ( bbp_is_single_user_edit() && ( $new_template = bbp_get_single_user_edit_template()) ) :727 elseif ( bbp_is_single_user_edit() && ( $new_template = bbp_get_single_user_edit_template() ) ) : 713 728 714 729 // Single View 715 elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template()) ) :730 elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) : 716 731 717 732 // Topic merge 718 elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template()) ) :733 elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) : 719 734 720 735 // Topic split 721 elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template()) ) :736 elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) : 722 737 723 738 // Topic edit 724 elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template()) ) :739 elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) : 725 740 726 741 // Editing a reply 727 elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template()) ) :742 elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) : 728 743 729 744 // Editing a topic tag 730 elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) : 745 elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template() ) ) : 746 747 // Editing a topic tag 748 elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) : 731 749 endif; 732 750 … … 770 788 'post_content' => '', 771 789 'post_type' => bbp_get_forum_post_type(), 772 'post_status' => 'publish' 790 'post_status' => 'publish', 791 'is_archive' => true 773 792 ) ); 774 793 … … 786 805 'post_content' => '', 787 806 'post_type' => bbp_get_topic_post_type(), 788 'post_status' => 'publish' 807 'post_status' => 'publish', 808 'is_archive' => true 789 809 ) ); 790 810 … … 800 820 'post_content' => get_post_field( 'post_content', bbp_get_topic_id() ), 801 821 'post_type' => bbp_get_topic_post_type(), 802 'post_status' => bbp_get_topic_status() 822 'post_status' => bbp_get_topic_status(), 823 'is_single' => true 803 824 ) ); 804 825 … … 858 879 // Reset the post with our new title 859 880 bbp_theme_compat_reset_post( array( 860 'post_title' => sprintf( __( 'Edit Topic Tag: %s', 'bbpress' ), '<span>' . bbp_get_topic_tag_name() . '</span>' ) ,881 'post_title' => sprintf( __( 'Edit Topic Tag: %s', 'bbpress' ), '<span>' . bbp_get_topic_tag_name() . '</span>' ) 861 882 ) ); 862 883 … … 868 889 // Reset the post with our new title 869 890 bbp_theme_compat_reset_post( array( 870 'post_title' => sprintf( __( 'Topic Tag: %s', 'bbpress' ), '<span>' . bbp_get_topic_tag_name() . '</span>' ) ,891 'post_title' => sprintf( __( 'Topic Tag: %s', 'bbpress' ), '<span>' . bbp_get_topic_tag_name() . '</span>' ) 871 892 ) ); 872 893 … … 1068 1089 // Show topics of tag 1069 1090 } else { 1070 $new_content = $bbp->shortcodes->display_topics_of_tag 1091 $new_content = $bbp->shortcodes->display_topics_of_tag( array( 'id' => bbp_get_topic_tag_id() ) ); 1071 1092 } 1072 1093 … … 1501 1522 // Topic tag page 1502 1523 } elseif ( bbp_is_topic_tag() ) { 1503 $posts_query->query_vars['post_type'] = bbp_get_topic_post_type(); 1524 $posts_query->query_vars['post_type'] = bbp_get_topic_post_type(); 1525 $posts_query->query_vars['posts_per_page'] = get_option( '_bbp_topics_per_page', 15 ); 1504 1526 } 1505 1527 -
branches/plugin/bbp-includes/bbp-core-shortcodes.php
r3376 r3386 133 133 134 134 // Unset global queries 135 $bbp->forum_query = null;136 $bbp->topic_query = null;137 $bbp->reply_query = null;135 $bbp->forum_query = array(); 136 $bbp->topic_query = array(); 137 $bbp->reply_query = array(); 138 138 139 139 // Unset global ID's 140 $bbp->current_forum_id = null;141 $bbp->current_topic_id = null;142 $bbp->current_reply_id = null;140 $bbp->current_forum_id = 0; 141 $bbp->current_topic_id = 0; 142 $bbp->current_reply_id = 0; 143 143 144 144 // Reset the post data -
branches/plugin/bbp-includes/bbp-core-widgets.php
r3375 r3386 653 653 654 654 <?php 655 $author_link = bbp_get_reply_author_link( array( 'type' => 'both', 'size' => 14 ) ); 656 $reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url() ) . '" title="' . bbp_get_reply_excerpt( bbp_get_reply_id(), 50 ) . '">' . bbp_get_reply_topic_title() . '</a>'; 657 655 658 /* translators: bbpress replies widget: 1: reply author, 2: reply link, 3: reply date, 4: reply time */ 656 printf( _x( $show_date == 'on' ? '%1$s on %2$s, %3$s, %4$s' : '%1$s on %2$s', 'widgets', 'bbpress' ), bbp_get_reply_author_link( array( 'type' => 'both', 'size' => 14 ) ), '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url() ) . '" title="' . bbp_get_reply_excerpt( bbp_get_reply_id(), 50 ) . '">' . bbp_get_reply_topic_title() . '</a>', get_the_date(), get_the_time() );659 printf( _x( $show_date == 'on' ? '%1$s on %2$s, %3$s, %4$s' : '%1$s on %2$s', 'widgets', 'bbpress' ), $author_link, $reply_link, get_the_date(), get_the_time() ); 657 660 ?> 658 661 -
branches/plugin/bbp-includes/bbp-forum-template.php
r3349 r3386 60 60 function bbp_has_forums( $args = '' ) { 61 61 global $bbp; 62 63 // Make sure we're back where we started64 wp_reset_postdata();65 62 66 63 // Setup possible post__not_in array -
branches/plugin/bbp-includes/bbp-reply-template.php
r3382 r3386 69 69 global $wp_rewrite, $bbp; 70 70 71 // Make sure we're back where we started72 wp_reset_postdata();73 74 71 // Default status 75 72 $default_status = join( ',', array( 'publish', $bbp->closed_status_id ) ); … … 137 134 138 135 // Only add pagination if query returned results 139 if ( (int) $bbp->reply_query->found_posts && (int) $bbp->reply_query->posts_per_page ) {136 if ( !bbp_is_query_name( 'bbp_widget' ) && (int) $bbp->reply_query->found_posts && (int) $bbp->reply_query->posts_per_page ) { 140 137 141 138 // If pretty permalinks are enabled, make our pagination pretty … … 245 242 $bbp_reply_id = $reply_id; 246 243 244 // Currently inside a replies loop 245 elseif ( isset( $bbp->reply_query->post->ID ) ) 246 $bbp_reply_id = $bbp->current_reply_id = $bbp->reply_query->post->ID; 247 247 248 // Currently viewing a reply 248 249 elseif ( ( bbp_is_single_reply() || bbp_is_reply_edit() ) && isset( $wp_query->post->ID ) ) 249 250 $bbp_reply_id = $bbp->current_reply_id = $wp_query->post->ID; 250 251 // Currently inside a replies loop252 elseif ( isset( $bbp->reply_query->post->ID ) )253 $bbp_reply_id = $bbp->current_reply_id = $bbp->reply_query->post->ID;254 251 255 252 // Fallback -
branches/plugin/bbp-includes/bbp-topic-template.php
r3382 r3386 69 69 global $wp_rewrite, $wp_query, $bbp, $wpdb; 70 70 71 // Make sure we're back where we started72 if ( !bbp_is_topic_tag() )73 wp_reset_postdata();74 75 71 // What are the default allowed statuses (based on user caps) 76 72 if ( !bbp_is_query_name( 'bbp_widget' ) && bbp_get_view_all() ) … … 228 224 229 225 // Only add pagination if query returned results 230 if ( ( (int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts ) && (int) $bbp->topic_query->posts_per_page ) {226 if ( !bbp_is_query_name( 'bbp_widget' ) && ( (int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts ) && (int) $bbp->topic_query->posts_per_page ) { 231 227 232 228 // Limit the number of topics shown based on maximum allowed pages … … 244 240 elseif ( bbp_is_single_view() ) 245 241 $base = bbp_get_view_url(); 242 243 // Topic tag 244 elseif ( bbp_is_topic_tag() ) 245 $base = bbp_get_topic_tag_link(); 246 246 247 247 // Page or single post … … 2391 2391 global $bbp; 2392 2392 2393 if ( !isset( $bbp->topic_query ) )2393 if ( empty( $bbp->topic_query ) ) 2394 2394 return false; 2395 2395 … … 2435 2435 global $bbp; 2436 2436 2437 if ( !isset( $bbp->topic_query ) )2437 if ( empty( $bbp->topic_query ) ) 2438 2438 return false; 2439 2439 … … 2824 2824 // Add before and after if description exists 2825 2825 if ( !empty( $term->term_id ) ) 2826 $retval = get_term_link( $term ->term_id, bbp_get_topic_tag_tax_id() );2826 $retval = get_term_link( $term, bbp_get_topic_tag_tax_id() ); 2827 2827 2828 2828 // No link -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-protected.php
r3207 r3386 8 8 */ 9 9 10 // Make sure we're back where we started11 wp_reset_postdata();12 13 10 ?> 14 11 -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-reply.php
r3366 r3386 7 7 * @subpackage Theme 8 8 */ 9 10 // Make sure we're back where we started11 wp_reset_postdata();12 9 13 10 ?> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-topic.php
r3375 r3386 7 7 * @subpackage Theme 8 8 */ 9 10 // Make sure we're back where we started11 wp_reset_postdata();12 9 13 10 ?>
Note: See TracChangeset
for help on using the changeset viewer.