Maybe use some other bbPress/BuddyPress conditional tags
bbPress Conditional Tags
Template Tag Reference
Note: The BuddyPress codex page is undergoing some updates. There are a few that are now depreciated, you can find an accurate list here.
I also wrote a plugin that makes it super easy to see what conditional tags are being used on a page 🙂
(You first need to install https://wordpress.org/plugins/query-monitor/)
Awesome! I didn’t know of these plugins, they will greatly help me! For the case in question I’ll probably use is_buddypress() and/or bp_is_my_profile().
Something strange: I am on a BuddyPress group associated forum (user created group and user created an associated forum for that group). The monitor says bbp_is_single_forum() is true, but when I query bbp_is_single_forum() in this context from within page.php, I get false! Please note this is only the case for group associated forums, using regular forums bbp_is_single_forum() returns true when viewing them. A bug?
Update: after some debugging, bbp_is_single_forum() returns false in page.php when being on a group associated forum because the condition “if ( is_singular( bbp_get_forum_post_type() ) || bbp_is_query_name( ‘bbp_single_forum’ ) )” returns false. If particular, “is_singular( bbp_get_forum_post_type()” returns false even though bbp_get_forum_post_type() returns “forum”, exactly the same as when a regular forum is being used. Any idea?