Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to simply know if a topic/forum is private?


  • BenM
    Participant

    @alysko

    Hi,

    I use Private status to protect some forums and I would like to have a login page instead of 404 on private posts because it’s very inconvenient for people who have subscribed to a topic and click on the link to read new replies, to see a 404 if they are not logged in. (bbPress Private groups doesn’t work for this too.)

    I tried a lot of things, but I was never able to catch status of topic’s forum with a single function.

    bbp_is_forum_private doesn’t work here (there’s no ID).
    get_queried_object() is empty.

    I can have topic slug ($wp_query->query['topic']) but strangely, get_page_by_path doesn’t work.

    Finaly, I have to make a SQL request to find ID and post_parent (so, forum) from slug, then use bbp_is_forum_private (to post_parent because it doesn’t work witk ID and ancestor)! It’s a little bit… heavy.

    Do you have a best method?

  • You must be logged in to reply to this topic.
Skip to toolbar