Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I check if a WordPress user is logged in to bbpress?

  • @bobdobbs

    Participant

    I’m wanting to create conditional logic that responds to whether a user is logged in to bbpress.

    Googling helped me to find these two functions:

    bb_current_user_can()
    bb_is_user_logged_in()

    However, when I use them, I get the error “Call to undefined function bb)…”.

    This happens even when I tie my containing function to the hook ‘plugins_loaded’, which I believe fires after all activated plugins have loaded.

    (I first tried to use the hook ‘wp’)

    So I’m just double-checking…

    Should I be able to use either of those two functions to test if a user requesting a resource is a logged-in bbpress user?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @robin-w

    Moderator

    I suspect those functions are bbpress version 1

    bbpress 2.x just uses wordpress login, so the standard wordpress function

    is_user_logged_in()

    will tell you if the user is logged in.

    @bobdobbs

    Participant

    Hi Robin.

    I specifically want to discover if the user is logged in as a user of bbpress.

    This is to account for a case where I have some registered websites users who are not forum users.

    For the moment I’m testing capabilities.
    At the moment the only people with access to the forum are people who can create posts.

    So I’m testing of the user has the capability create_topic

    This might work, but feels a bit clumsy to me.

    @robin-w

    Moderator

    ok, so you have users who have a wordpress role, but no bbpress role – yes?

    If so, then testing for a bbpress role, or as you are suggesting a capability such as create_topic seems a sensible solution.

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