Using the clues in this topic, this is what I have working for ANY FSE Block theme with the wonderful style-pack plugin:
function fse_bbpress_template( $template ) {
$template = ABSPATH . WPINC . '/template-canvas.php';
return $template;
}
function fse_bbp_theme_compat( $template ) {
$template= BSP_PLUGIN_DIR.'/templates/bbpress.php';
return $template;
}
if ( ! function_exists( 'fse_bbpress_support' ) ) {
function fse_bbpress_support() {
// gt current theme dir
$theme_dir = get_template_directory();
// Detect if FSE theme or traditional.
// FSE Block themes require a theme.json file.
// Use that to check instead of theme name or parent theme name.
// Perhaps a better method is available, but this works for now.
$fse_theme = false;
if ( file_exists( $theme_dir.'/theme.json' ) ) { $fse_theme = true; }
if ( !$fse_theme ) { return; }
// disabled because it doesn't seem to be needed, regardless of style pack
// $bsp_style_settings_theme_support['twentytwentytwo_activate'] setting
// template-canvas.php seems to be included by default
//add_filter( 'template_include', 'fse_bbpress_template' );
add_filter ( 'bbp_template_include_theme_compat' , 'fse_bbp_theme_compat' );
}
}
add_action( 'after_setup_theme', 'fse_bbpress_support' );
and this little helper function helped me figure out what template was getting loaded in the first place:
function fse_bbpress_print_template() {
if ( is_bbpress() ) {
//echo at the bottom of the page visibly
echo get_page_template();
// or echo the template silently as an HTML comment
// echo '<!-- ' . get_page_template() . ' -->';
}
}
// DISABLE THIS ACTION HOOK AS SOON AS POSSIBLE! DO NOT LEAVE IT ACTIVE WHEN DEBUGGING IS DONE!
add_action( 'bbp_template_after_forums_loop', 'fse_bbpress_print_template' );
I’ve tried this on a few different FSE Block themes, and BBPress is displaying properly, and the style tweaks from the wonderful Style-Pack plugin are being applied.
Like I said, it’s working regardless of the $bsp_style_settings_theme_support[‘twentytwentytwo_activate’] setting within the BSP plugin, but it uses the template from the plugin so it would still need to be installed an active, even without any styling tweaks applied.
It’s not a permanent solution, but perhaps aspects of this could be applied to the BSP plugin, or your own custom solution.