Skip to:
Content
Pages
Categories
Search
Top
Bottom

is_bbpress() defined on the BuddyPress profile page


  • nirgalo
    Participant

    @nirgalo

    Hi, I am using is_bbpress() in page.php to check whether I am in a bbPress context. It seems BuddyPress and bbPress are sharing the same profile page. Therefore, when the latter is being displayed, bbPress is being defined, and this triggers wrong behavior in my code. So, how can I check a bbPress or BuddyPress profile page is being displayed so I can fix my code? thx.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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 🙂

    https://wordpress.org/plugins/query-monitor-bbpress-buddypress-conditionals/
    (You first need to install https://wordpress.org/plugins/query-monitor/)


    nirgalo
    Participant

    @nirgalo

    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().


    nirgalo
    Participant

    @nirgalo

    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar