• I’m trying to configure forums using the bbpress plugin that can only be viewed by logged in users. I attempted creating them as private but found that sub-forums don’t show up on my root /forums page. Another forum suggested using is_user_logged_in() to determine whether or not forums are displayed.

    What is the best place to put a check for is_user_logged_in() that will hide all forum related pages and posts from non-logged in users. I am up for other suggestions as well if there is a better way to do it, but I am not finding much documentation.

Viewing 4 replies - 1 through 4 (of 4 total)
  • @bingles Have you found a solution?

    Thread Starter bingles

    (@bingles)

    Yes I did.

    The solution was to create a file in my theme’s folder named bbpress.php. I then copied the contents of my theme’s page.php file into the new file and modified it to only show it’s contents when a user is logged in. In my case it looked like the following:

    `if( is_user_logged_in() ) {
    get_template_part( ‘loop’, ‘page’ );
    }
    else{
    _e(‘You must be logged in to view this page.’, ‘twentyten-child’);
    }
    Apparently the bbpress plugin looks in a a particular order for the template it will use (see http://bbpress.org/forums/topic/where-do-i-choose-a-custom-template-for-the-bbpress-20-plugin). I chose bbpress.php since it is the first place it looks and is clear that it it for this plugin.

    Bingles, fast. Thanks for sharing your solution. I will give it a try.
    But it seems to me that this code makes the whole forum accesible only for members.
    Right?

    Thread Starter bingles

    (@bingles)

    Correct. I may have mis-named this by calling it “private forum”.

    The site I am working on only allows signed in users to view the forums.

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

The topic ‘Create private forum with bbpress Plugin’ is closed to new replies.