| @@ -1,10 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +//version 1.9.2 fixed private groups forums for subscriptions | |
| 4 | + | |
| 3 | 5 | add_filter ('bbp_before_has_topics_parse_args', 'pg_has_topics') ; |
| 4 | 6 | |
| 5 | 7 | function pg_has_topics( $args = '' ) { |
| 6 | - | |
| 8 | + //check if being called by subscriptions and if so skip filtering (as you can only subscribe to forums you can already see) | |
| 9 | + if($args['post__in']) { | |
| 10 | + return $args ; | |
| 11 | + } | |
| 7 | 12 | $default_post_parent = bbp_is_single_forum() ? bbp_get_forum_id() : 'any'; |
| 8 | 13 | |
| 9 | 14 | if ($default_post_parent == 'any') { |
| 10 | 15 | if ( bbp_is_user_keymaster()) return $args; |
| @@ -37,9 +42,10 @@ | ||
| 37 | 42 | |
| 38 | 43 | //Loop through all the posts |
| 39 | 44 | foreach ( $post_ids as $post_id ) { |
| 40 | 45 | //Get the Forum ID based on Post Type Topic |
| 41 | - $forum_id = private_groups_get_forum_id_from_post_id($post_id, 'topic'); | |
| 46 | + $topic=bbp_get_topic_post_type() ; | |
| 47 | + $forum_id = private_groups_get_forum_id_from_post_id($post_id, $topic); | |
| 42 | 48 | //Check if User has permissions to view this Post ID |
| 43 | 49 | //by calling the function that checks if the user can view this forum, and hence this post |
| 44 | 50 | if (private_groups_can_user_view_post_id($forum_id)) { |
| 45 | 51 | |