Ticket #2343: forum_id_check.patch
File forum_id_check.patch, 1.6 KB (added by , 14 years ago) |
---|
-
bp-forums-templatetags.php
6 6 var $topics; 7 7 var $topic; 8 8 9 var $forum_id; 10 9 11 var $in_the_loop; 10 12 11 13 var $pag_page; … … 25 27 $this->pag_num = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page; 26 28 $this->type = $type; 27 29 $this->search_terms = $search_terms; 30 $this->forum_id = $forum_id; 28 31 29 32 switch ( $type ) { 30 33 case 'newest': default: … … 693 696 var $posts; 694 697 var $post; 695 698 699 var $forum_id; 696 700 var $topic_id; 697 701 var $topic; 698 702 … … 716 720 717 721 $this->topic_id = $topic_id; 718 722 $forum_template->topic = (object) bp_forums_get_topic_details( $this->topic_id ); 723 $this->forum_id = $forum_template->topic->forum_id; 719 724 720 725 $this->posts = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num ) ); 721 726 … … 811 816 if ( !$topic_id && $bp->current_component == $bp->groups->slug && 'forum' == $bp->current_action && 'topic' == $bp->action_variables[0] ) 812 817 $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] ); 813 818 814 if ( is_numeric( $topic_id ) ) 819 if ( is_numeric( $topic_id ) ) { 815 820 $topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max ); 816 else 821 if ( $bp->current_component == $bp->groups->slug && $bp->groups->current_group->forum_id != $topic_template->forum_id ) 822 return false; 823 } else { 817 824 return false; 825 } 818 826 819 827 return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), &$topic_template ); 820 828 }