Skip to:
Content

bbPress.org

Opened 21 months ago

Last modified 4 weeks ago

#3473 assigned defect (bug)

Search displays hidden forums to participants

Reported by: wpsolr's profile wpsolr Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.10 Priority: high
Severity: normal Version: 2.6.9
Component: Component - Search Keywords: needs-patch
Cc:

Description

Hi,

1) I created a hidden forum with topics and replies as a keymaster
2) I logged in as a Participant
3) A search will not display topics and replies as expected, but the forum itself is displayed!
4) Clicking on the forum shows a 404 page, as expected

WordPress 6.0
Plugins active: bbPress, Classic Editor

Attachments (6)

bbpress-track-support-hidden-forum-in-search.png (457.2 KB) - added by wpsolr 21 months ago.
Capture of search showing a hidden forum to a particpant
bbpress-track-support-hidden-forum-in-search-1.png (429.3 KB) - added by wpsolr 21 months ago.
Hidden forum not shown in list, as expected
bbpress-track-support-hidden-forum-in-search-2.png (701.2 KB) - added by wpsolr 21 months ago.
Hidden forum settings
bbpress-track-support-hidden-forum-in-search-3.png (836.0 KB) - added by wpsolr 21 months ago.
All topics of hidden forum not shown on search, as expected
bbpress-track-support-hidden-forum-in-search-4.png (780.8 KB) - added by wpsolr 21 months ago.
Participant role
bbpress-track-support-hidden-forum-in-search-5.png (757.7 KB) - added by wpsolr 21 months ago.
Hidden forum created by keymaster (not by the participant)

Change History (9)

@wpsolr
21 months ago

Capture of search showing a hidden forum to a particpant

@wpsolr
21 months ago

Hidden forum not shown in list, as expected

@wpsolr
21 months ago

All topics of hidden forum not shown on search, as expected

@wpsolr
21 months ago

Hidden forum created by keymaster (not by the participant)

#1 @johnjamesjacoby
21 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 2.6.10
  • Owner set to johnjamesjacoby
  • Priority changed from normal to high
  • Status changed from new to assigned

#2 @Robin W
21 months ago

I could not replicate this in my test site.

User has not responded further in support topic

https://bbpress.org/forums/topic/search-displays-hidden-forums-to-participants/

#3 @Robin W
21 months ago

correction, I've now replicated

the issue is in \bbpress\includes\search\template.php line 49 onwards

mods and above get permissions to see all from line 50 which sets a list of $defaultpost_status?

participants/spectators get $defaultperm? = 'readable' set instead of $defaultpost_status?.
'perm' is a wordpress wp_query setting, and wordpress does not have 'hidden' status, so allows hidden forums to show, nit sure why, but it does !

if the 'else' line is revised to set permissions, then all works as it should

this filter fixes

add_filter ('bbp_after_has_search_results_parse_args', 'bsp_search_hide_hidden_forums') ;


<?php
function bsp_search_hide_hidden_forums ($args) {
                if (!empty($args['perm'])) {
                unset ($args['perm']) ;
                $post_statuses = array(bbp_get_public_status_id()) ;
                // Add support for private status
                if ( current_user_can( 'read_private_topics' ) || current_user_can( 'read_private_forums' ) ) {
                        $post_statuses[] = bbp_get_private_status_id();
                }
                // Add support for hidden status
                if ( current_user_can( 'read_hidden_forums' )) {
                        $post_statuses[] = bbp_get_hidden_status_id();
                }
                // Join post statuses together
                $args['post_status'] = $post_statuses;
        }
return $args ;
}
Version 0, edited 21 months ago by Robin W (next)
Note: See TracTickets for help on using tickets.