Ticket #2651: 2651.patch
File 2651.patch, 2.9 KB (added by , 15 years ago) |
---|
-
bp-forums.php
375 375 376 376 $defaults = array( 377 377 'topic_id' => false, 378 'include' => false, // Comma-separated string of post IDs to include 379 'exclude' => false, // Comma-separated string of post IDs to exclude 378 380 'page' => 1, 379 381 'per_page' => 15, 380 382 'order' => 'ASC' … … 382 384 383 385 $args = wp_parse_args( $args, $defaults ); 384 386 387 if ( $args['include'] ) { 388 $args['post_id'] = $args['include']; 389 unset( $args['include'] ); 390 } 391 392 // Format exclude IDs in the bbPress fashion 393 if ( $args['exclude'] ) { 394 $exclude = '-' . str_replace( ',', ',-', $args['exclude'] ); 395 $exclude = str_replace( '--', '-', $exclude ); 396 if ( $args['post_id'] ) 397 $args['post_id'] = (string) $args['post_id'] . ",$exclude"; 398 else 399 $args['post_id'] = $exclude; 400 } 401 385 402 $query = new BB_Query( 'post', $args, 'get_thread' ); 386 403 return bp_forums_get_post_extras( $query->results ); 387 404 } -
bp-forums/bp-forums-templatetags.php
711 711 var $sort_by; 712 712 var $order; 713 713 714 function BP_Forums_Template_Topic( $topic_id, $per_page, $max ) {714 function BP_Forums_Template_Topic( $topic_id, $per_page, $max, $include, $exclude ) { 715 715 global $bp, $current_user, $forum_template; 716 716 717 717 $this->pag_page = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1; 718 718 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 719 719 720 $this->include = $include; 721 $this->exclude = $exclude; 722 720 723 $this->order = $order; 721 724 $this->topic_id = $topic_id; 722 725 $forum_template->topic = (object) bp_forums_get_topic_details( $this->topic_id ); 723 726 724 $this->posts = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, ' page' => $this->pag_page, 'per_page' => $this->pag_num, 'order' => $this->order ) );727 $this->posts = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, 'include' => $this->include, 'exclude' => $this->exclude, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'order' => $this->order ) ); 725 728 726 729 if ( !$this->posts ) { 727 730 $this->post_count = 0; … … 812 815 813 816 $defaults = array( 814 817 'topic_id' => false, 818 'include' => false, // Comma-separated list of post IDs to include 819 'exclude' => false, // Comma-separated list of post IDs to exclude 815 820 'per_page' => 15, 816 821 'max' => false 817 822 ); … … 823 828 $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] ); 824 829 825 830 if ( is_numeric( $topic_id ) ) 826 $topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max );831 $topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max, $include, $exclude ); 827 832 else 828 833 return false; 829 834