Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] How to detect use is on a bp page

  • Avatar of crystalcommerce
    crystalcommerce
    Participant

    @crystalcommerce

    I have content I am putting into the sidebar, but I do not want the content to show up when the user is in the members section etc.
    I tried !bp_is_page() but that doesn’t seem to work.
    I just want to detect all bp pages to void them all out.

    Thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Did you glance at the current forum topics or search?

     

    There is a very similar question , please read that thread first and see if that helps at all.

    Avatar of crystalcommerce
    crystalcommerce
    Participant

    @crystalcommerce

    Could you be more specific on the post? I found a recent one where a user wanted to get the members page, what I want is to detect if they are on any of them not just one.
    Thanks

    Avatar of shanebpdev
    shanebp
    Participant

    @shanebp

    I’m also interested in an answer to your question.

    There used to be this bool, but no longer:
    `$is_member_page`

    You could check $bp_unfiltered_uri[0] but I’m not sure that will work if you also have
    `define ( ‘BP_ENABLE_ROOT_PROFILES’, true );`

    Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    Avatar of shanebpdev
    shanebp
    Participant

    @shanebp

    @chouf1

    I don’t think members is a component.

    What does bp_user_query have to do with the OP’s question ?

    What about this ?

    `if ( 0 == bp_displayed_user_id() )
    //show the widget
    `

    Avatar of imath
    imath
    Moderator

    @imath

    Hi,

    The different conditionnal tags are located in /bp-core/bp-core-template.php so you’ll find there all you need to restrict the display of content to specific areas.

    For instance, if you want your content to only show when not in members area and not in the user’s area, you can use something like this :

    if( !bp_is_members_component() && !bp_is_user() ) {
    
            echo "not in members or user's area";
    
    }
    Avatar of shanebpdev
    shanebp
    Participant

    @shanebp

    @imath

    Thank you.

    Avatar of crystalcommerce
    crystalcommerce
    Participant

    @crystalcommerce

    Yea that does work, thanks imath.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.