ok, so I followed your test.
I created a forum called ‘test hidden forum’ and a topic within it called ‘test hidden topic’
I logged in as a participant and did a search for ‘hidden’ – no results.
What search were you doing that I could replicate?
EDIT – sorry just looked at what you did in trac – I’ll try that
yes just tried ‘forum’ and it does not show
it could be a theme or plugin issue
Themes
As a test switch to a default theme such as twentytwenty, and see if this fixes.
Plugins
If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users
Health Check & Troubleshooting
Then come back
I did not see your answer. Sorry for that!
I reinstalled a blank bbPress, with the same issue.
You can see the hidden forum here with users keymaster/keymaster or participant/participant
1. can’t see as I don’t have access
2. when you say ‘blank bbpress’ did you do the full tests above?
1. You can connect with participant/participant or keymaster/keymaster here
2. I should have said “plain” instead: WP + bbPress + 1 hidden forum + 1 public topen in forum
thanks – I can see the issue – suggest you change the keymaster pw to prevent this site being hacked
I’ll now use my test site to see if I can work out what is happening
ok, I’ve found the problem, and this filter fixes
add_filter ('bbp_after_has_search_results_parse_args', 'rew_search') ;
function rew_search ($args) {
/*mods and above get permissions to see all from line 50 of \bbpress\includes\search/template.php which sets a list of $default['post_status']
//participants/spectators get $default['perm'] = 'readable' set instead of $default['post_status'].
'perm' is a wordpress wp_query setting, and wordpress does not have 'hidden' status, so allows hidden forums to show
//so if $default['perm'] is set, we add a 'post_status' as well to restrict to statuses user is allowed
*/
if (!empty($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 ;
}
if you are using
bbp style pack
then this is included in version 5.0.8 just released
Otherwise put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
I’ll update the bbpress trac ticket shortly