Changeset 3637
- Timestamp:
- 11/27/2011 11:05:06 AM (14 years ago)
- Location:
- branches/plugin
- Files:
-
- 4 edited
-
bbp-includes/bbp-core-shortcodes.php (modified) (9 diffs)
-
bbp-includes/bbp-topic-template.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/css/bbpress.css (modified) (1 diff)
-
bbpress.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-shortcodes.php
r3634 r3637 141 141 142 142 // Unset global ID's 143 $bbp->current_forum_id = 0; 144 $bbp->current_topic_id = 0; 145 $bbp->current_reply_id = 0; 143 $bbp->current_forum_id = 0; 144 $bbp->current_topic_id = 0; 145 $bbp->current_reply_id = 0; 146 $bbp->current_topic_tag_id = 0; 146 147 147 148 // Reset the post data … … 248 249 249 250 // Set passed attribute to $forum_id for clarity 250 $ forum_id = $attr['id'];251 $bbp->current_forum_id = $forum_id = $attr['id']; 251 252 252 253 // Bail if ID passed is not a forum … … 313 314 $this->start( 'bbp_topic_archive' ); 314 315 315 // Query defaults 316 $topics_query = array( 317 'author' => 0, 318 'show_stickies' => true, 319 'order' => 'DESC', 320 ); 321 322 // Load the topic index 323 bbp_has_topics( $topics_query ); 316 // Filter the query 317 add_filter( 'bbp_pre_has_topics_query', array( $this, 'display_topic_index_query' ) ); 324 318 325 319 // Output template … … 351 345 352 346 // Set passed attribute to $forum_id for clarity 353 $ topic_id = $attr['id'];347 $bbp->current_topic_id = $topic_id = $attr['id']; 354 348 $forum_id = bbp_get_topic_forum_id( $topic_id ); 355 349 … … 381 375 if ( bbp_user_can_view_forum( array( 'forum_id' => $forum_id ) ) ) { 382 376 383 // Setup the meta_query 384 $replies_query['meta_query'] = array( array( 385 'key' => '_bbp_topic_id', 386 'value' => $topic_id, 387 'compare' => '=' 388 ) ); 389 390 // Setup an accurate replies query 391 bbp_has_replies( $replies_query ); 392 393 // Output the single topic 377 // Filter the query 378 add_filter( 'bbp_pre_has_replies_query', array( $this, 'display_topic_query' ) ); 379 380 // Output template 394 381 bbp_get_template_part( 'bbpress/content', 'single-topic' ); 395 382 396 383 // Forum is private and user does not have caps 397 384 } elseif ( bbp_is_forum_private( $forum_id, false ) ) { 398 bbp_get_template_part( 'bbpress/feedback', 'no-access' );385 bbp_get_template_part( 'bbpress/feedback', 'no-access' ); 399 386 } 400 387 … … 446 433 447 434 // Set passed attribute to $reply_id for clarity 448 $ reply_id = $attr['id'];435 $bbp->current_reply_id = $reply_id = $attr['id']; 449 436 $forum_id = bbp_get_reply_forum_id( $reply_id ); 450 437 … … 548 535 */ 549 536 public function display_topics_of_tag( $attr, $content = '' ) { 537 global $bbp; 550 538 551 539 // Sanity check required info … … 553 541 return $content; 554 542 543 // Unset globals 544 $this->unset_globals(); 545 546 // Start output buffer 547 $this->start( 'bbp_topics_of_tag' ); 548 555 549 // Set passed attribute to $ag_id for clarity 556 $tag_id = $attr['id']; 557 558 // Setup tax query 559 $args = array( 'tax_query' => array( array( 560 'taxonomy' => bbp_get_topic_tag_tax_id(), 561 'field' => 'id', 562 'terms' => $tag_id 563 ) ) ); 564 565 // Unset globals 566 $this->unset_globals(); 567 568 // Start output buffer 569 $this->start( 'bbp_topics_of_tag' ); 570 571 // Load the topics 572 bbp_has_topics( $args ); 550 $bbp->current_topic_tag_id = $tag_id = $attr['id']; 551 552 // Filter the query 553 add_filter( 'bbp_pre_has_topics_query', array( $this, 'display_topics_of_tag_query' ) ); 573 554 574 555 // Output template … … 745 726 // Return contents of output buffer 746 727 return $this->end(); 728 } 729 730 /** Query Filters *********************************************************/ 731 732 /** 733 * Filter the query for the topic index 734 * 735 * @since bbPress (rxxxx) 736 * 737 * @param array $args 738 * @return array 739 */ 740 public function display_topic_index_query( $args = array() ) { 741 $args['author'] = 0; 742 $args['show_stickies'] = true; 743 $args['order'] = 'DESC'; 744 return $args; 745 } 746 747 /** 748 * Filter the query for the topic index 749 * 750 * @since bbPress (rxxxx) 751 * 752 * @param array $args 753 * @return array 754 */ 755 public function display_topic_query( $args = array() ) { 756 global $bbp; 757 758 $args['meta_query'] = array( array( 759 'key' => '_bbp_topic_id', 760 'value' => $bbp->current_topic_id, 761 'compare' => '=' 762 ) ); 763 764 return $args; 765 } 766 767 /** 768 * Filter the query for topic tags 769 * 770 * @since bbPress (r3637) 771 * 772 * @global bbPress $bbp 773 * @param array $args 774 * @return array 775 */ 776 public function display_topics_of_tag_query( $args = array() ) { 777 global $bbp; 778 779 $args['tax_query'] = array( array( 780 'taxonomy' => bbp_get_topic_tag_tax_id(), 781 'field' => 'id', 782 'terms' => $bbp->current_topic_tag_id 783 ) ); 784 785 return $args; 747 786 } 748 787 } -
branches/plugin/bbp-includes/bbp-topic-template.php
r3636 r3637 76 76 77 77 // Default arguments 78 $default = array (78 $default = array( 79 79 80 80 // Narrow query down to bbPress topics … … 111 111 'post_status' => $default_status, 112 112 ); 113 114 // Maybe query for topic tags 115 if ( !bbp_is_query_name( 'bbp_widget' ) && bbp_is_topic_tag() ) { 116 $default['term'] = bbp_get_topic_tag_slug(); 117 $default['taxonomy'] = bbp_get_topic_tag_tax_id(); 118 } 113 119 114 120 // Filter the default arguments -
branches/plugin/bbp-themes/bbp-twentyten/css/bbpress.css
r3635 r3637 631 631 -------------------------------------------------------------- */ 632 632 633 .bbp-topics-front tr.super-sticky td,634 .bbp-topics tr.super-sticky td,635 .bbp-topics tr.sticky td,636 .bbp-forum-content tr.sticky td{633 .bbp-topics-front ul.super-sticky, 634 .bbp-topics ul.super-sticky, 635 .bbp-topics ul.sticky, 636 .bbp-forum-content ul.sticky { 637 637 background-color: #ffffe0 !important; 638 638 font-size: 1.1em; -
branches/plugin/bbpress.php
r3618 r3637 231 231 */ 232 232 public $current_reply_id = 0; 233 234 /** 235 * @var string Current topic tag id 236 */ 237 public $current_topic_tag_id = 0; 233 238 234 239 /** Users *****************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.