BuddyDev

Restrict user from creating topic on certain bbPress Forums

Yesterday, one of our members( Joshua )  asked me how to restrict users from creating topic in specific bbPress based forum but allow users to reply them to the topic. I looked at the filters and put some code that does it. I am sharing it here hoping that some of you might find it useful.

You can put the following code in your theme's functions.php

In the above code, I am using forum id 222 as an example, you can change that to your own forum id or even extend the code to include multiple forums ( An example is given below now)

Restricting to multiple forums:-

Added this to make it easy for restricting multiple forums.

Bonus:  Restrict replies to bbpress forum topic by the topic id.

 

8 Responses to Restrict user from creating topic on certain bbPress Forums

  • Thanks again for your help! This worked perfectly!

  • Hi, I saw your post titled; "Restrict user from creating topic on certain bbPress Forums"
    The code you provided seem to be just what I've been looking for and am currently thrilled to have come across it. One thing that I've been having trouble achieving is the part where you mention :

    "…you can change that to your own forum id or even extend the code to include multiple forums."

    I've been able to successfully change the forum id but was not able to "extend" the code to add more forum ids. Could you give some more specific directions as to HOW I need to "extend" the code?

    Thank you so much in advance

    • Hi Tyler,
      Thank you for the comment.

      I have added the section to show how to restrict multiple forums at the bottom of the post. Hope that helps.

      • Wow that was quick! Thanks so much ! it works perfectly!
        Very much appreciated!

  • Hi,

    Do you know a way how to disable reply on certains topics ? Only admin can post reply.

    Thanks in advance.

    Regards

    • Thank you for asking. I have added an example at the bottom of the post.

      Hope that helps.